Skip to content

Commit

Permalink
Ability to list stylesheets in an array, fix #20
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Padvorac committed May 4, 2013
1 parent c238243 commit 47fab4c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions js/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ define({
css_path: window.location.protocol + '//' + window.location.hostname + (window.location.port === '' ? '' : ':'+ window.location.port) + window.location.pathname + 'css/styles.css',
// You can configure any path by just deleteing the one above and uncommenting the one below to point at your css directory
//css_path: 'http://localhost/css/styles.css',
// You can manually list the css files to process by giving a css_paths array
//css_paths: ['../css/styles.css', '../css/buttons.css'],

// You can optionally set configuration for marked.js
marked_options: {
Expand Down
10 changes: 10 additions & 0 deletions js/views/style/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ function($, _, Backbone, dashboardPageTemplate, jscssp, config, marked) {
var that = this;
that.$el.html('Loading styles');

if(config.css_paths) {
config.css_path = config.css_paths[0]
}

require(['text!' + config.css_path], function (styles) {
var masterStyle = config.css_path.substr(config.css_path.lastIndexOf('/')+1);
var markedOpts = _.extend({ sanitize: false, gfm: true }, config.marked_options || {});
Expand Down Expand Up @@ -57,6 +61,12 @@ function($, _, Backbone, dashboardPageTemplate, jscssp, config, marked) {
currentMenu.sheets.push(sheet);
}
});

if(config.css_paths) {
for(var i = 1; i < config.css_paths.length; i++) {
currentMenu.sheets.push(config.css_paths[i])
}
}
menus.push(currentMenu);

$(that.el).html(_.template(dashboardPageTemplate, {_:_, menuTitle: menuTitle, menus: menus, entry: masterStyle}));
Expand Down

0 comments on commit 47fab4c

Please sign in to comment.