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,7 +6,9 @@ | ||
6 | * of the tasks | 6 | * of the tasks |
7 | */ | 7 | */ |
8 | 8 | ||
9 | +var argv = require('minimist')(process.argv.slice(2)); | ||
9 | var gutil = require('gulp-util'); | 10 | var gutil = require('gulp-util'); |
11 | +var path = require('path'); | ||
10 | 12 | ||
11 | /** | 13 | /** |
12 | * The main paths of your project handle these with care | 14 | * The main paths of your project handle these with care |
@@ -16,8 +18,13 @@ exports.paths = { | @@ -16,8 +18,13 @@ exports.paths = { | ||
16 | dist: 'dist', | 18 | dist: 'dist', |
17 | tmp: '.tmp', | 19 | tmp: '.tmp', |
18 | e2e: 'e2e', | 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 | * Wiredep is the lib which inject bower dependencies in your project | 30 | * Wiredep is the lib which inject bower dependencies in your project |
gulp/styles.js
@@ -25,11 +25,14 @@ var buildStyles = function() { | @@ -25,11 +25,14 @@ var buildStyles = function() { | ||
25 | style: 'expanded' | 25 | style: 'expanded' |
26 | }; | 26 | }; |
27 | 27 | ||
28 | - var injectFiles = gulp.src([ | ||
29 | - path.join(conf.paths.src, '/app/**/*.scss'), | 28 | + var srcPaths = [ |
30 | path.join('!' + conf.paths.src, '/app/index.scss'), | 29 | path.join('!' + conf.paths.src, '/app/index.scss'), |
31 | path.join('!' + conf.paths.src, '/app/layout/scss/*.scss') | 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 | var injectOptions = { | 37 | var injectOptions = { |
35 | transform: function(filePath) { | 38 | transform: function(filePath) { |
package.json
@@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
8 | "ng-forward": "0.0.1-alpha.12" | 8 | "ng-forward": "0.0.1-alpha.12" |
9 | }, | 9 | }, |
10 | "scripts": { | 10 | "scripts": { |
11 | - "build": "webpack; gulp clean && gulp build", | 11 | + "build": "webpack; gulp clean && gulp --theme=$npm_package_config_theme build", |
12 | "webpack": "webpack", | 12 | "webpack": "webpack", |
13 | "karma": "concurrently \"webpack -w\" \"karma start\"", | 13 | "karma": "concurrently \"webpack -w\" \"karma start\"", |
14 | "docs": "gulp ngdocs; static-server docs", | 14 | "docs": "gulp ngdocs; static-server docs", |
@@ -19,7 +19,7 @@ | @@ -19,7 +19,7 @@ | ||
19 | "test": "webpack -w --test", | 19 | "test": "webpack -w --test", |
20 | "jenkins": "webpack && karma start --single-run", | 20 | "jenkins": "webpack && karma start --single-run", |
21 | "postinstall": "bower install; typings install; cd dev-scripts; typings install; cd ../; npm run fix-jqlite", | 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 | "generate-indexes": "ts-node --project ./dev-scripts ./dev-scripts/generate-index-modules.ts", | 23 | "generate-indexes": "ts-node --project ./dev-scripts ./dev-scripts/generate-index-modules.ts", |
24 | "fix-jqlite": "ts-node --project ./dev-scripts dev-scripts/fix-jqlite.ts" | 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,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 @@ | @@ -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 | +} |