-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Better Grunt + Bower -> Removing Normalize.css from src/
#160
Conversation
This also removes `forms-core.css` which was effectively Normalize.css' form related styles prefixed with `.pure-form`.
Running `grunt` will now use Bower to install Normalize.css. As of 1.0.0 Bower got much faster, and it also uses a cache so the install only happens once. Added `grunt build` which does not the "import" or "test" tasks.
@@ -187,7 +157,7 @@ grunt.initConfig({ | |||
options: { | |||
banner: [ | |||
'/*!', | |||
'normalize.css v<%= normalize.version %> | MIT License | git.io/normalize', | |||
'normalize.css v1.1.2 | MIT License | git.io/normalize', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this version be read from bower.json? I can imagine someone changing the version in bower.json and forgetting to change this value, too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it should. But it's a race condition, I'm trying to figure out how to process this in a function or something, after normalize has been installed via bower.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm, yeah, that is a pickle, then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I created a bower-meta
Grunt task which uses bower
to load the metadata for all the Bower dependencies and add that data to Grunt's config object. But it makes the build take twice as long, 0.5sec to 1sec :( So I'm not sure this is going to be worth it.
grunt.registerTask('bower-meta', 'Make bower.json data available to Grunt.', function () {
var bower = require('bower'),
done = this.async();
bower.commands.list(null, {offline: true}).on('end', function (results) {
var dependencies = results.dependencies;
Object.keys(dependencies).forEach(function (name) {
var dependency = dependencies[name],
meta = dependency.pkgMeta,
config = {},
bowerConfig = grunt.config.getRaw('bower') || {};
if (!meta) {
grunt.fatal('Bower dependency ' + name + ' not installed.');
}
config[name] = meta;
// Merge dependency into `bower` config.
grunt.config('bower', grunt.util._.merge(bowerConfig, config));
});
grunt.log.writeln('Loaded metadata for Bower packages.');
done();
});
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't the version specified in bower.json
be solidified and then read from there, just like the package.json
is read? No more race condition, only one place to edit, though slightly more laborious (no semver squishiness, not sure that's a bad thing, though).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I switch to doing that.
@ericf Did you want to hold this back for 0.3.0 instead of merging it in for 0.2.2? |
@tilomitra correct, this is not a bug fix and is a pretty major change. |
This is a revamp of the Grunt + Bower setup to remove the need for checking Normalize.css into the
src/
tree. As a result,forms-core.css
has also been removed, because Pure really does depend on Normalize.css being on the page.The Gruntfile has also been simplified, running
grunt
will install any Bower dependencies, run tests, and build Pure. Thewatch
task first runsgrunt
(default), then observes changes and runs thetest
andbuild
task, no Bower installing (so it's faster).The also updates our npm dependencies to their latest versions.