I'm trying to define an asset compiler according to the documentationhttp://compoundjs.com/docs/#asset-compiler-adding-your-own-compiler, however, I keep getting an error:
app.use(compound.assetsCompiler.add('scss', {
^
TypeError: Cannot call method 'add' of undefined
My entire environment.js
file looks like:
module.exports = function (compound) {
var express = require('express');
var app = compound.app;
app.configure(function (){
app.use(compound.assetsCompiler.add('scss', {
render: function (str, options, fn) {
try {
fn(null, @scss.render(str));
} catch (err) {
fn(err);
}
},
scss: require('node-sass'),
sourceExtension: 'scss',
destExtension: 'css'
}).init());
app.use(express.static(app.root + '/public', { maxAge: 86400000 }));
app.set('jsDirectory', '/javascripts/');
app.set('cssDirectory', '/stylesheets/');
app.set('cssEngine', 'scss');
app.use(express.bodyParser());
app.use(express.cookieParser('secret'));
app.use(express.session({secret: 'secret'}));
app.use(express.methodOverride());
app.use(app.router);
});
};
I tried a console.log(compound.assetsCompiler);
just before the app.use(compount.assetsCompiler...
statement and sure enough I get undefined
. The documentation also says to use compound.assetCompiler.add(...);
(singular asset) which I assume is a typo but since it got that typo wrong multiple times I tried it as well but had the same problem. Does anyone have any idea how to fix this?