I have a hard time to configure Ember CLI to use uncss. The setup:
> ember new foobar
> cd foobar
> bower install --save-dev bootstrap
> ember generate route index
app/templates/index.hbs
<h1>Hello World!</h1>
Brocfile.js
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var app = new EmberApp();
app.import('vendor/bootstrap/dist/css/bootstrap.css');
module.exports = app.toTree();
What do I have to do to use https://github.com/sindresorhus/broccoli-uncss? The assets part of http://iamstef.net/ember-cli/ says that it's easy but it doesn't describe how to actually do it.
It's not well documented in broccoli-uncss readme, but if you look at the index.js and test.js, you would get the idea.
Basically you pass in a tree as the first parameter, and an options hash as the second parameter, And options hash should have an html option, telling where the index.html is. In your case I think what Oliver said is true. You could use the html in your dist folder. I am not sure how to integrate that with the ember-cli, but my guess is probably you need an ember-cli add-on, http://reefpoints.dockyard.com/2014/06/24/introducing_ember_cli_addons.html.
var uncss = require('broccoli-uncss');
var cssTree = uncss('dist`, {
// html file to uncss, or this could be a live link to the html
html: ['dist/index.html']
});
// you might somewhat merge this with ember-cli app tree here.
module.exports = cssTree;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With