Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Docs for Sage 9 #30

Merged
merged 22 commits into from
Feb 7, 2018
Merged

[WIP] Docs for Sage 9 #30

merged 22 commits into from
Feb 7, 2018

Conversation

retlehs
Copy link
Member

@retlehs retlehs commented Apr 5, 2016

post-launch

  • rename 'theme wrapper' to 'blade templates', setup 301
Sage uses [Laravel's Blade](https://laravel.com/docs/5.5/blade) templating engine.

## Passing data to templates

Sage includes a `sage/template/{$class}/data` filter that can be used to pass data to templates. This is the most simple way to pass data.

```php
add_filter('sage/template/page/data', function (array $data) {
    $data['header_image'] = get_field('header_image');
    $data['header_content'] = get_field('header_content');
    return $data;
});

In your Blade templates for pages you can now use {{ $header_image }} and {{ $header_content }} to output the data.

Controller for Sage 9, written by Darren Jacoby, offers another method for passing data to templates. The Controller plugin works off of files in the app/controllers/ directory.

@retlehs retlehs self-assigned this Apr 5, 2016
@retlehs retlehs closed this Nov 27, 2016
@retlehs retlehs reopened this Nov 27, 2016
@retlehs retlehs changed the base branch from master to docs November 27, 2016 19:19
@Log1x
Copy link
Member

Log1x commented Dec 30, 2016

Thought I'd throw it here rather than an issue (hope that's ok)--

https://github.com/roots/docs/blob/sage-9/sage/theme-development-and-building.md

To clear up confusion, when adding third party packages you omit the extension.

So import 'slick-carousel/slick/slick.min.js'; becomes import 'slick-carousel/slick/slick.min'; -- Just ran into this issue when beginning to convert my theme from Sage 8.5 to Sage 9.

Feel free to delete this post once acknowledged.

smutek and others added 17 commits January 12, 2017 00:36
Remove file extension from slick js import. (File extension causes 5:8  error  Unexpected use of file extension "js")
Update external js dependencies example to reflect the current file structure.
Update scss dependencies to reflect the current file structure
Update theme-development-and-building.md doc
Added reminder to change 3rd party packages relative paths. Without those paths `yarn run build:production` will fail since Webpack can't find the font files.
Deleted '!defaults' and formatted
Sage 9 - 3rd party package's relative paths in production
Add front-end package manager history
Changed Theme Structure from 8.5.1 to 9-beta3
updated theme structure chart
Version in sync with main README.md in terms of requirements. Installation command is more precise for the current situation (until 9.0.0 comes out).
Update theme-installation.md
typo did you mean main.scss?
Update  theme-development-and-build.md
@retlehs retlehs merged commit ae133bf into docs Feb 7, 2018
@retlehs retlehs deleted the sage-9 branch March 15, 2020 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants