Skip to content

Roots 7.0.0 - #982

Merged
retlehs merged 61 commits into
masterfrom
7.0.0
Jul 3, 2014
Merged

retlehs merged 61 commits into
masterfrom
7.0.0

Conversation

@retlehs

@retlehs retlehs commented Feb 5, 2014

Copy link
Copy Markdown
Member

What's new

Leaner Roots

Soil will now be a plugin that contains:

  • Markup changes/clean up
    • wp_head() clean up
    • Remove WP version from RSS feeds
    • Clean up <html> attributes
    • Clean up <link> tags
    • Clean up body_class()
    • Wrap embedded media as suggested by Readability
    • Use <figure> and <figcaption> for WP captions
    • Remove unnecessary dashboard widgets
    • Remove unnecessary self-closing tags
  • Nice search
  • Relative URLs

The above features will be enabled in Roots (or any other theme) if Soil is activated by using add_theme_support:

  • add_theme_support('soil-clean-up');
  • add_theme_support('soil-nice-search');
  • add_theme_support('soil-root-relative-urls');

Removed from Roots:

  • lib/cleanup.php - Move roots_get_search_form to lib/utils.php
  • lib/widgets.php - Remove vCard widget, move register sidebars to lib/init.php
  • lib/relative-urls.php

Bower for front-end package management

Bower is now being used to pull in Modernizr, jQuery, Bootstrap and Respond to assets/vendor/. Whenever you're adding front-end assets to your project, you can use bower install <package> to add them to the vendor directory.

We're also now using grunt-modernizr to make a lean build based on what tests you use in your styles and JS.

If you check out the 7.0.0 branch, run npm install from the theme dir and bower install will run after the node dependencies have been installed.

LESS organization

LESS files are organized differently, see #961 for details. tl;dr:

├── components
│   ├── _buttons.less
│   ├── _forms.less
│   ├── _media.less
│   └── _wp-classes.less
├── layouts
│   │── pages
│   │   └── _home.less
│   │── _footer.less
│   │── _general.less
│   │── _header.less
│   │── _pages.less
│   │── _posts.less
│   └── _sidebar.less
├── _bootstrap.less
├── _global.less
├── _variables.less
└── main.less

Grunt workflow

Previously, every time you updated your CSS or JS, a minified files and changes to lib/scripts.php had to be committed to the repo. The repo no longer includes any generated front-end assets. Grunt tasks are now split into two: dev and build.

The dev task runs JSHint, compiles your LESS (non-minified) and concatenates your JS

The build task runs JSHint, compiles and minifies your LESS, runs UglifyJS for concatenation and minification, generates a lean Modernizr build, and revisions CSS and JS based on the hashes.

During build, assets-manifest.json is generated with the names of the revisioned files. lib/scripts.php reads that file and tells WordPress the correct path to the assets.

Testing

Check out the 7.0.0 branch and run npm install from the theme directory. If you don't use Bedrock, you'll need to add the following to your wp-config.php:

define('WP_ENV', 'development');

Grunt tasks:

  • grunt dev
  • grunt watch (same as dev except watches for file changes)
  • grunt build — for staging/production

Also grab https://github.com/roots/soil's new branch and enable the plugin

Note: things are subject to change!

These changes are not yet final. Keep an eye on this PR for updates.

TODO:
- Update README
- Use grunt-bower-task?
@retlehs retlehs added this to the 7.0.0 milestone Feb 5, 2014
@kalenjohnson

Copy link
Copy Markdown
Contributor

Looking good. I'd be very happy to use Bower for Bootstrap in 7.0, I've been using it plenty for other projects, and even for grabbing extra Javascript/jQuery plugins for Wordpress themes/plugins

Not to go all crazy, but has anyone had experience with Gulp? http://gulpjs.com/

It's newer than GruntJS, but so far has been getting rave reviews, and looks easier to set up than Grunt, by a long shot. Even though I've gotten my head wrapped around the Gruntfile, it's still not very intuitive IMO.

@retlehs retlehs mentioned this pull request Feb 5, 2014
@talves

talves commented Feb 5, 2014

Copy link
Copy Markdown

This branch is definitely a +1. I include the file assets for bootstrap in my version (tags) commits on my private repos, so I know what version of bootstrap I included in a release of a particular theme. The alternative was targeting a specific release in the bower file. Still not sure what way I like best.

@retlehs Thanks for considering the bower solution
@kalenjohnson Thanks for recommending it

@raulghm

raulghm commented Feb 5, 2014

Copy link
Copy Markdown

@kalenjohnson #gulpjs is pretty, all gruntjs plugins are compatible with gulpjs, but not there is one as "grunt-wp-version" for cache styles and script files

@talves

talves commented Feb 5, 2014

Copy link
Copy Markdown

@retlehs I propose we copy (grunt-contrib-copy) the dist files the theme requires back into the appropriate asset folders for release.

I feel this will make it easier for us to ignore the whole vendor directory when deploying and deploy only the needed asset folders.

Here is a compare of my proposed changes

hariadi and others added 9 commits February 20, 2014 11:17
* default use filename version revving instead of querystring
* versioning file will be ignore
Use grunt-wp-assets for version task
Dev: don't minify
Build: minify, lean Modernizr build

Dev assets will load if you have defined your WP_ENV as development
If you don't use Bedrock, you'll need to add this to your wp-config.php:

define('WP_ENV', 'development');

TODO: lib/scripts.php shouldn't need to be committed for changes after
running the version task
By writing to assets-manifest.json with grunt-filerev-assets, it's
no longer necessary to commit changes to lib/scripts.php when developing
@Gavrisimo

Copy link
Copy Markdown

How about creating dist folder that will also be in .gitignore and where grunt will place built files.

The reason for this, amongst other things, is that you won't have to worry about any git conflicts in files built with grunt, which can be pita sometimes... =D

@retlehs

retlehs commented Feb 22, 2014

Copy link
Copy Markdown
Member Author

Files built with grunt are now gitignored, but would still like to add
dist to have better separation

Sent from my iPhone

On Feb 22, 2014, at 6:29 AM, "Miloš Gavrilović" notifications@github.com
wrote:

How about creating dist folder that will also be in .gitignore and where
grunt will place built files.

The reason for this, amongst other things, is that you won't have to worry
about any git conflicts in files built with grunt, which can be pita
sometimes... =D

—
Reply to this email directly or view it on
GitHubhttps://github.com//pull/982#issuecomment-35801456
.

@retlehs retlehs mentioned this pull request Feb 22, 2014
@retlehs

retlehs commented Feb 22, 2014

Copy link
Copy Markdown
Member Author

note: updated grunt workflow is not final. renaming the assets brings concerns about possible 404s related to caching. might go back to the querystring method and get rid of the new grunt-filerev and grunt-filerev-assets additions

@kalenjohnson

Copy link
Copy Markdown
Contributor

Just thinking about decoupling Roots from Bootstrap, with how mixins work for both LESS and SASS, we could potentially remove all Bootstrap classes from the markup and set up something like:

.main { .col-sm-8 }

I think the issue could be from the necessity of the .row class, that would still need to be wrapped somehow.

@JulienMelissas

Copy link
Copy Markdown
Contributor

I was thinking about this the other day too and ran into the same issue.
The yeoman generator someone made was able to decouple some things - I
think if we remove Bootstrap we're going to open another can of worms.

I guess the question is is "do we open that can"? I don't think 7.0.0 is
going to deal with it. 8.0 however, hmmmm

  • Julien

On Fri, May 30, 2014 at 12:56 PM, Kalen Johnson notifications@github.com
wrote:

Just thinking about decoupling Roots from Bootstrap, with how mixins work
for both LESS and SASS, we could potentially remove all Bootstrap classes
from the markup and set up something like:

.main { .col-sm-8 }

I think the issue could be from the necessity of the .row class, that
would still need to be wrapped somehow.

—
Reply to this email directly or view it on GitHub
#982 (comment).

@retlehs

retlehs commented May 30, 2014

Copy link
Copy Markdown
Member Author

yeah, i need to just get 7.0.0 out the door at this point. i'm going to finish up some docs for the site and then release it as is (maybe this weekend?)

sorry it's taken so long, lots going on outside of roots right now 😓

@JulienMelissas

Copy link
Copy Markdown
Contributor

Understood. You are the man!

  • Julien

On Fri, May 30, 2014 at 1:37 PM, Ben Word notifications@github.com wrote:

yeah, i need to just get 7.0.0 out the door at this point. i'm going to
finish up some docs for the site and then release it as is (maybe this
weekend?)

sorry it's taken so long, lots going on outside of roots right now [image:
😓]

—
Reply to this email directly or view it on GitHub
#982 (comment).

@markthethomas

Copy link
Copy Markdown
Contributor

What do people think about adding imagemin (https://github.com/gruntjs/grunt-contrib-imagemin) to the gruntfile to compress any images included in the assets dir? I've found it helpful in projects using yeoman (spec. angular.) to slim down any images that can't be fetched dynamically. Not absollutely necessary, per se, but could help and easy to configure.

@retlehs thanks again for your work on this!

@gitviola

Copy link
Copy Markdown

@markthethomas great idea! I would also suggest to add spritesmith (https://github.com/Ensighten/grunt-spritesmith)

@QWp6t

QWp6t commented May 31, 2014

Copy link
Copy Markdown
Member

I think Imagemin and Spritesmith are too unstable/unreliable across various platforms and architectures, and they have nothing to do with Roots.

I personally use them in my projects, but I would be against including them. They sometimes even fail during npm install which will lead to unnecessary headaches for Roots devs as they have to deal with the support requests here and on the forums.

@JulienMelissas

Copy link
Copy Markdown
Contributor

I 100% agree with @QWp6t!

On Saturday, May 31, 2014, QWp6t notifications@github.com wrote:

I think Imagemin and Spritesmith are too unstable/unreliable across
various platforms and architectures, and they have nothing to do with Roots.

I personally use them in my projects, but I would be against including
them. They sometimes even fail during npm install which will lead to
unnecessary headaches for Roots devs as they have to deal with the support
requests here and on the forums.

—
Reply to this email directly or view it on GitHub
#982 (comment).

  • Julien

@markthethomas

Copy link
Copy Markdown
Contributor

Huh; I've never had any problems with it but that could just be my interaction with it so far. I'd suggest the relation to roots though would be compressing a filetype that's usually included (images of some kind) in a project.

But since there are so many image compression tools (CLI and otherwise) and since people can easily include it on their own if they like, I'll agree with @QWp6t and @JulienMelissas and I don't think inclusion should happen here.

And, I suppose, a good WP theme shouldn't have many non-dynamic images anyhow :)

here's a gist for a gruntfile with imagemin and autoprefixer if anyone wants to include them on their own: https://gist.github.com/markthethomas/6b114f5fd7d55d29eca3

retlehs and others added 6 commits June 6, 2014 11:16
Retrieve manifest.json from local file system. Fixes  #1048
If I add JavaScript packages to my `assets/js/plugins/` directory, they must be concatenated, uglified, and added to `scripts.js` to be used in my theme. The `watch:js` task should also note changes to those files and directories.
Make `grunt watch:js` include `assets/js/plugins/**/*.js`
@retlehs retlehs mentioned this pull request Jun 30, 2014
retlehs added a commit that referenced this pull request Jul 3, 2014
@retlehs
retlehs merged commit 17716e5 into master Jul 3, 2014
@retlehs
retlehs deleted the 7.0.0 branch July 3, 2014 23:52
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.