I’m stuck on a simple task of getting Broccoli to work for something as simple as compiling sass. I asked the question on SO but it may be a bit obscure.
I have app.scss
in my app/styles
directory and this is what I’ve tried in my brocfile (which I tried to model after the sample app’s brocfile:
// Brocfile.js
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var pickFiles = require('broccoli-static-compiler')
var compileSass = require('broccoli-sass');
var filterTemplates = require('broccoli-template')
var app = new EmberApp();
var styles = 'styles'
styles = pickFiles(styles, {
srcDir: './bower_components/foundation/scss',
destDir: './app/styles'
});
var appsScss = compileSass([styles], './app/styles/app.scss', './app/styles/app.css');
module.exports = app.toTree(appsScss);
IMO Broccoli is woefully under documented. I volunteer to contribute some guide docs ( I can put my useless BA in English to use ) but I would need someone to give me a pretty thorough tutoring.
That aside, what am I doing wrong?
– Edit 1:
Oh, and I get this error when I ember serve
:
version: 0.1.3
valid watchman found, version: [3.0.0]
Livereload server on port 35729
Serving on http://0.0.0.0:4200/
Attempting to watch missing directory: styles
Error: Attempting to watch missing directory: styles
at EventEmitter.Watcher_addWatchDir [as addWatchDir] (/Users/jdillon/Desktop/openSrc/shoppingList/node_modules/ember-cli/node_modules/broccoli-sane-watcher/index.js:90:11)
at /Users/jdillon/Desktop/openSrc/shoppingList/node_modules/ember-cli/node_modules/broccoli/lib/builder.js:67:35
at $$$internal$$tryCatch (/Users/jdillon/Desktop/openSrc/shoppingList/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:470:16)
at $$$internal$$invokeCallback (/Users/jdillon/Desktop/openSrc/shoppingList/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:482:17)
at /Users/jdillon/Desktop/openSrc/shoppingList/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1066:13
at $$rsvp$asap$$flush (/Users/jdillon/Desktop/openSrc/shoppingList/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1531:9)
at process._tickCallback (node.js:419:13)
– Edit 2:
I updated my brocfile.js
to this simple diddy:
/* global require, module */
var EmberApp = require('ember-cli/lib/broccoli/ember-app');
var compileSass = require('broccoli-sass');
var app = new EmberApp();
var appsScss = compileSass([], './app/styles/app.scss', './app/styles/app.css');
module.exports = app.toTree(appsScss);
This doesnt return any errors with ember serve
.
In app.scss
:
@import "../../bower_components/foundation/scss/normalize";
@import "../../bower_components/foundation/scss/foundation.scss";
$bgcolor: blue;
h2 {
background-color: $bgcolor;
}
The $bgcolor
variable correctly compiles and changes the background color, but I only have about 800 lines of compiled CSS, when I should have north of 4.4k due to Foundation.