Windows users are not able to run grunt on a subpath due to platform
restrictions. So we provide this option to provide a workaround for that.
Thanks to Ty Delean who proposed this idea.
Includes multiple changes to the shifter task to simplify and
support this:
* Use grunt.file for shifter yui 'module' detection rather than our own
70 line function
* Use grunt.util.spawn rather than our own exec for shifter
* Improve behaviour on various yui subdirectories
We have to add the 'async' depndency to npm because we are running
multiple async operations in the single task. We use async.eachSeries to
run each shifter job sequentally (else the output would be unreadable
when running async).
We also run shifter in non-recursive mode on the module directory so its
not building everything (thanks to Ryan for pointing this out!)
We mess around with the cwd to find a shifter path, not ideal but avoids
having to refactor the shifter task.
Also fix jshint errors..
1) The gruntfile runs in a nodejs environment and not a browser
environment.
2) There was an uninitialised variable
This is in preperation for the watch task and doing a few things:
1) Switch away from 'grunt.file.expandMapping' to the declarative syntax
for doing the same thing, as recommended in docs:
http://gruntjs.com/api/grunt.file#grunt.file.expandmapping
2) Factor the renaming function into shared function so it can be used
from the watch task too.
3) Shared the file glob'ing pattern for match AMD js files between
jshint and uglify task (this removes the node_modules exception..
we should add it to both if we need it).
4) Rename the task configuration - I am just doing this because it looks
like 'dynamic_mappings' is some how magic config option when you
look at the manual:
http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically
But in fact, it's just a task confguration name.
Two reasons for this change:
1) The configuration here is confusing, it seems like we are setting the
'files' option, but in fact we are just generating a task configuration
called 'files'. Lets try and avoid confusion.
2) It makes it possible for 'watch' to override the src
* Introduce the 'css' task - this will give us flexibility to do things
in future rather than relying on the inbuilt 'less' task (e.g. sourcemap
generating task which doesn't run by default)
* Introduce 'amd' task which runs only amd tasks
* Introduce 'js' task which runs all JS (amd/shifter) tasks
* Tweak the ordering so that slow shifter always runs last (useful for
people like me who forget to specif the task)
Previously we were using recess to build bootstrap base as it was what
was used by the original project. But recess is no longer maintained.
Now we use grunt for building js, it makes sense to use it for less too.
(If you really don't want to use grunt, you almost certainly can just
use lessc -x as it uses the same less.js on backend).
Unfortunately, this is not perfect yet. It will build the entire
repository every time - which takes a while because it builds all the
yui modules (On linux it correctly only builds whats in the current dir).