Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into coriander
Browse files Browse the repository at this point in the history
* upstream/master:
  Controller examples
  Change syntax of template call to match other files in views/
  Remove test output.
  Don't remove comments when clearing files.
  Use latest Controller (soberwp/controller#26)
  assets -> resources/assets
  Update operator for template call
  Remove post format reference in template call
  Update comments, add some more
  Add soberwp/controller
  Optimize CSS Assets safe = true (roots#1901)
  update inline documentation to reflect correct theme file locations
  Fix stylelint errors.
  Add Stylelint linting for scss files.
  Use official SASS transpiled partials instead
  Add Tachyons PR link
  Update CHANGELOG.md
  Add Tachyons as CSS framework option
  Add Tachyons as a CSS framework option

# Conflicts:
#	resources/assets/styles/common/_global.scss
#	resources/assets/styles/common/_variables.scss
#	resources/assets/styles/components/_comments.scss
#	resources/assets/styles/components/_forms.scss
#	resources/assets/styles/components/_wp-classes.scss
#	resources/assets/styles/layouts/_header.scss
#	resources/assets/styles/main.scss
#	yarn.lock
  • Loading branch information
Patrick Vézina committed Jul 11, 2017
2 parents 9afec2c + 8172de6 commit 1183355
Show file tree
Hide file tree
Showing 22 changed files with 321 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "stylelint-config-standard"
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Move `templates/` to `resources/views/`, move `assets/` to `resources/assets/`, rename `base.blade.php` to `app.blade.php` ([#1864](https://github.com/roots/sage/pull/1864))
* Add option to configure build settings ([#1822](https://github.com/roots/sage/pull/1822))
* Add support for HTML injection ([#1817](https://github.com/roots/sage/pull/1817))
* Add Tachyons as a CSS framework option ([#1867](https://github.com/roots/sage/pull/1867))

### 9.0.0-beta.2: January 19th, 2017
* Fix Browersync ([#1815](https://github.com/roots/sage/pull/1815))
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,17 @@ Sage is a WordPress starter theme with a modern development workflow.
* ES6 for JavaScript
* [Webpack](https://webpack.github.io/) for compiling assets, optimizing images, and concatenating and minifying files
* [Browsersync](http://www.browsersync.io/) for synchronized browser testing
* [Laravel's Blade](https://laravel.com/docs/5.3/blade) as a templating engine
* [Laravel Blade](https://laravel.com/docs/5.3/blade) as a templating engine
* [Controller](https://github.com/soberwp/controller) for passing data to Blade templates
* CSS framework options:
* [Bootstrap 4](http://getbootstrap.com/)
* [Foundation](http://foundation.zurb.com/)
* [Tachyons](http://tachyons.io/)
* None (blank slate)
* Font Awesome (optional)

See a working example at [roots-example-project.com](https://roots-example-project.com/).

### Recommended extensions

* [Controller](https://github.com/soberwp/controller) — WordPress plugin to enable a basic controller when using Blade with Sage 9

## Requirements

Make sure all dependencies have been installed before moving on:
Expand All @@ -56,7 +54,7 @@ $ composer create-project roots/sage your-theme-name dev-master
During theme installation you will have the options to:

* Update theme headers (theme name, description, author, etc.)
* Select a CSS framework (Bootstrap, Foundation, none)
* Select a CSS framework (Bootstrap, Foundation, Tachyons, none)
* Add Font Awesome
* Configure Browsersync (path to theme, local development URL)

Expand All @@ -83,6 +81,7 @@ themes/your-theme-name/ # → Root of your Sage based theme
│ │ ├── images/ # → Theme images
│ │ ├── scripts/ # → Theme JS
│ │ └── styles/ # → Theme stylesheets
│ ├── controllers/ # → Controller files
│ ├── functions.php # → Composer autoloader, theme includes
│ ├── index.php # → Never manually edit
│ ├── screenshot.png # → Theme screenshot for WP admin
Expand Down Expand Up @@ -116,6 +115,8 @@ Sage 8 documentation is available at [https://roots.io/sage/docs/](https://roots

Sage 9 documentation is currently in progress and can be viewed at [https://github.com/roots/docs/tree/sage-9/sage](https://github.com/roots/docs/tree/sage-9/sage).

Controller documentation is available at [https://github.com/soberwp/controller#usage](https://github.com/soberwp/controller#usage).

## Contributing

Contributions are welcome from everyone. We have [contributing guidelines](https://github.com/roots/guidelines/blob/master/CONTRIBUTING.md) to help you get started.
Expand Down
36 changes: 30 additions & 6 deletions app/lib/Sage/PostCreateProject.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public static function selectFramework(Event $event)
$frameworks = [
'Bootstrap',
'Foundation',
'Tachyons',
'None'
];
$framework = $io->select('<info>Select a CSS framework</info> <comment>(Default: Bootstrap)</comment>', $frameworks, 0);
Expand All @@ -63,22 +64,45 @@ public static function selectFramework(Event $event)
file_put_contents('package.json', preg_replace("/{$default_framework_pattern}/", '"foundation-sites": "6.3.0"', file_get_contents('package.json')));
file_put_contents('resources/assets/styles/main.scss', str_replace('@import "~bootstrap/scss/bootstrap";' . "\n", '@import "~foundation-sites/scss/foundation";' . "\n" . '@include foundation-everything;' . "\n", file_get_contents('resources/assets/styles/main.scss')));
file_put_contents('resources/assets/scripts/main.js', str_replace("import 'bootstrap';\n", "import 'foundation-sites/dist/js/foundation';\n", file_get_contents('resources/assets/scripts/main.js')));
foreach($files_to_clear as $file) {
file_put_contents($file, '');
}

static::clearFiles($files_to_clear);

break;
case 2:
file_put_contents('package.json', preg_replace("/{$default_framework_pattern}/", '"tachyons-sass": "^4.7.1"', file_get_contents('package.json')));
file_put_contents('resources/assets/styles/main.scss', str_replace('@import "~bootstrap/scss/bootstrap";' . "\n", '@import "~tachyons-sass/tachyons";' . "\n", file_get_contents('resources/assets/styles/main.scss')));
file_put_contents('resources/assets/scripts/main.js', str_replace("import 'bootstrap';\n", '', file_get_contents('resources/assets/scripts/main.js')));

static::clearFiles($files_to_clear);

break;
case 3:
file_put_contents('package.json', preg_replace("/\s+{$default_framework_pattern},/", '', file_get_contents('package.json')));
file_put_contents('resources/assets/styles/main.scss', str_replace('@import "~bootstrap/scss/bootstrap";' . "\n", '', file_get_contents('resources/assets/styles/main.scss')));
file_put_contents('resources/assets/scripts/main.js', str_replace("import 'bootstrap';\n", '', file_get_contents('resources/assets/scripts/main.js')));
foreach($files_to_clear as $file) {
file_put_contents($file, '');
}

static::clearFiles($files_to_clear);

break;
}
}
}

public static function clearFiles(array $files)
{
foreach($files as $file) {
// First, we will pull the comment from the first line of each file
// we want to empty. Stylelint does not allow empty files.
if ($handle = fopen($file, 'r')) {
$comment = fgets($handle);
fclose($handle);
}

// Finally, we will replace the file's contents with just the comment.
file_put_contents($file, $comment);
}
}

public static function addFontAwesome(Event $event)
{
$io = $event->getIO();
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@
"php": ">=5.6.4",
"composer/installers": "~1.0",
"illuminate/view": "~5.4.0",
"illuminate/config": "~5.4.0"
"illuminate/config": "~5.4.0",
"soberwp/controller": "dev-master"
},
"require-dev": {
"squizlabs/php_codesniffer": "^2.8.0"
Expand Down
226 changes: 224 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1183355

Please sign in to comment.