Michael Joseph Aubry
Michael Joseph Aubry

Reputation: 13482

Connect assets with handlebars?

The typical way to include the connect assets file is

!= css("main")

That is with .jade though. I am using handlebars and I have no clue how I can add the file?

I am using node-sass as well.

Upvotes: 0

Views: 474

Answers (1)

joost
joost

Reputation: 6669

Just guessing, something like this works (see blog post):

var connectAssets = require("connect-assets")();
app.use(connectAssets);
var hbs = require('hbs');
hbs.registerHelper('css', function() {
  var css = connectAssets.options.helperContext.css.apply(this, arguments);
  return new hbs.SafeString(css);
});

Upvotes: 2

Related Questions