hadronjs / hadron

Minimalist, hackable publishing platform
62 stars 9 forks source link

Support for *.less files used only in the frontend #17

Closed ghost closed 9 years ago

ghost commented 9 years ago

Hi,

In hadron-theme-nodus.js i see the following settings:

use_stylesheets: function() {
    return {
      default: [
        self.fontAwesome.exports.stylesheets.all,
        "http://fonts.googleapis.com/css?family=Lato:300,400,700",
        "styles/main.less"
      ],
      admin: [
        "styles/admin.less"
      ]
    };
  }

I see that i can specify common stylesheets (default) and stylesheets only for the backend (admin). Is it possible to specify stylesheets only for the frontend?

mariocasciaro commented 9 years ago

You can override the _layout.jade in your theme and add another injected section, for example:

doctype html
head
  meta(charset='utf-8')
  meta(name='viewport', content='width=device-width, initial-scale=1.0')
  block head

  //INJECT:styles:default
  //END INJECT

  //INJECT:styles:frontend
  //END INJECT

  //INJECT:scripts:default
  //END INJECT
body

Then specify a frontend property when you declare your stylesheets:

use_stylesheets: function() {
    return {
      default: [
        self.fontAwesome.exports.stylesheets.all,
        "http://fonts.googleapis.com/css?family=Lato:300,400,700",
        "styles/main.less"
      ],
      admin: [
        "styles/admin.less"
      ],
     frontend: [...]
    };
  }
ghost commented 9 years ago

this is exactly what i was looking for :) thanks for the help