Commit c3af8dfc29253aa989838446bcf8794feb7baee7
1 parent
b07589aa
Exists in
master
and in
1 other branch
Allow themes to define its own styles
Showing
7 changed files
with
40 additions
and
30 deletions
Show diff stats
gulp/conf.js
| ... | ... | @@ -6,7 +6,9 @@ |
| 6 | 6 | * of the tasks |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | +var argv = require('minimist')(process.argv.slice(2)); | |
| 9 | 10 | var gutil = require('gulp-util'); |
| 11 | +var path = require('path'); | |
| 10 | 12 | |
| 11 | 13 | /** |
| 12 | 14 | * The main paths of your project handle these with care |
| ... | ... | @@ -16,8 +18,13 @@ exports.paths = { |
| 16 | 18 | dist: 'dist', |
| 17 | 19 | tmp: '.tmp', |
| 18 | 20 | e2e: 'e2e', |
| 19 | - docs: 'docs' | |
| 21 | + docs: 'docs', | |
| 22 | + theme: argv.theme ? path.join('themes', argv.theme) : null | |
| 20 | 23 | }; |
| 24 | +exports.paths.allSources = [exports.paths.src]; | |
| 25 | +if(exports.paths.theme) { | |
| 26 | + exports.paths.allSources.push(exports.paths.theme); | |
| 27 | +} | |
| 21 | 28 | |
| 22 | 29 | /** |
| 23 | 30 | * Wiredep is the lib which inject bower dependencies in your project | ... | ... |
gulp/styles.js
| ... | ... | @@ -25,11 +25,14 @@ var buildStyles = function() { |
| 25 | 25 | style: 'expanded' |
| 26 | 26 | }; |
| 27 | 27 | |
| 28 | - var injectFiles = gulp.src([ | |
| 29 | - path.join(conf.paths.src, '/app/**/*.scss'), | |
| 28 | + var srcPaths = [ | |
| 30 | 29 | path.join('!' + conf.paths.src, '/app/index.scss'), |
| 31 | 30 | path.join('!' + conf.paths.src, '/app/layout/scss/*.scss') |
| 32 | - ], { read: false }); | |
| 31 | + ]; | |
| 32 | + conf.paths.allSources.forEach(function(src) { | |
| 33 | + srcPaths.push(path.join(src, '/app/**/*.scss')); | |
| 34 | + }); | |
| 35 | + var injectFiles = gulp.src(srcPaths, { read: false }); | |
| 33 | 36 | |
| 34 | 37 | var injectOptions = { |
| 35 | 38 | transform: function(filePath) { | ... | ... |
package.json
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | "ng-forward": "0.0.1-alpha.12" |
| 9 | 9 | }, |
| 10 | 10 | "scripts": { |
| 11 | - "build": "webpack; gulp clean && gulp build", | |
| 11 | + "build": "webpack; gulp clean && gulp --theme=$npm_package_config_theme build", | |
| 12 | 12 | "webpack": "webpack", |
| 13 | 13 | "karma": "concurrently \"webpack -w\" \"karma start\"", |
| 14 | 14 | "docs": "gulp ngdocs; static-server docs", |
| ... | ... | @@ -19,7 +19,7 @@ |
| 19 | 19 | "test": "webpack -w --test", |
| 20 | 20 | "jenkins": "webpack && karma start --single-run", |
| 21 | 21 | "postinstall": "bower install; typings install; cd dev-scripts; typings install; cd ../; npm run fix-jqlite", |
| 22 | - "start": "concurrently \"webpack -w\" \"gulp serve\"", | |
| 22 | + "start": "concurrently \"webpack -w\" \"gulp --theme=$npm_package_config_theme serve\"", | |
| 23 | 23 | "generate-indexes": "ts-node --project ./dev-scripts ./dev-scripts/generate-index-modules.ts", |
| 24 | 24 | "fix-jqlite": "ts-node --project ./dev-scripts dev-scripts/fix-jqlite.ts" |
| 25 | 25 | }, | ... | ... |
src/app/layout/navbar/redebrasil.scss
| ... | ... | @@ -1,16 +0,0 @@ |
| 1 | -.navbar { | |
| 2 | - min-height: 123px; | |
| 3 | - background:url("../assets/images/redebrasil/bg-header.png") repeat-x; | |
| 4 | - | |
| 5 | - .container-fluid { | |
| 6 | - .navbar-brand { | |
| 7 | - .noosfero-logo { | |
| 8 | - background:url("../assets/images/redebrasil/header-home.png") no-repeat; | |
| 9 | - padding: 0px 257px 63px 15px; | |
| 10 | - } | |
| 11 | - .noosfero-name { | |
| 12 | - display: none; | |
| 13 | - } | |
| 14 | - } | |
| 15 | - } | |
| 16 | -} |
src/app/redebrasil.scss
| ... | ... | @@ -0,0 +1,16 @@ |
| 1 | +.navbar { | |
| 2 | + min-height: 123px; | |
| 3 | + background:url("../assets/images/redebrasil/bg-header.png") repeat-x; | |
| 4 | + | |
| 5 | + .container-fluid { | |
| 6 | + .navbar-brand { | |
| 7 | + .noosfero-logo { | |
| 8 | + background:url("../assets/images/redebrasil/header-home.png") no-repeat; | |
| 9 | + padding: 0px 257px 63px 15px; | |
| 10 | + } | |
| 11 | + .noosfero-name { | |
| 12 | + display: none; | |
| 13 | + } | |
| 14 | + } | |
| 15 | + } | |
| 16 | +} | ... | ... |