Commit f9896e22915dca0f7edf096391b452ad682b72c2
1 parent
dce2b87d
Exists in
master
and in
30 other branches
Refactoring build task
Signed-off-by: Carlos Coêlho <carlospecter@gmail.com> Signed-off-by: Arthur Jahn <stutrzbecher@gmail.com>
Showing
6 changed files
with
10 additions
and
6 deletions
Show diff stats
gulp/build.js
| ... | ... | @@ -3,10 +3,13 @@ |
| 3 | 3 | var path = require('path'); |
| 4 | 4 | var gulp = require('gulp'); |
| 5 | 5 | var rename = require('gulp-rename'); |
| 6 | +var insert = require('gulp-insert'); | |
| 6 | 7 | var merge = require('merge-stream'); |
| 7 | 8 | var conf = require('./conf'); |
| 8 | 9 | |
| 9 | -var noosferoThemePrefix = path.join("/designs/themes/angular-theme", conf.paths.dist, '/'); | |
| 10 | +var themeName = conf.paths.theme.replace('-', ' '); | |
| 11 | +themeName = themeName.charAt(0).toUpperCase() + themeName.slice(1); | |
| 12 | +var noosferoThemePrefix = path.join("/designs/themes/", conf.paths.theme, '/'); | |
| 10 | 13 | |
| 11 | 14 | var $ = require('gulp-load-plugins')({ |
| 12 | 15 | pattern: ['gulp-*', 'main-bower-files', 'uglify-save-license', 'del'] |
| ... | ... | @@ -114,17 +117,18 @@ gulp.task('other', function () { |
| 114 | 117 | }); |
| 115 | 118 | |
| 116 | 119 | gulp.task('clean', function () { |
| 117 | - return $.del([path.join(conf.paths.dist, '/'), path.join(conf.paths.tmp, '/')]); | |
| 120 | + return $.del(["dist", path.join(conf.paths.tmp, '/')]); | |
| 118 | 121 | }); |
| 119 | 122 | |
| 120 | 123 | gulp.task('clean-docs', [], function() { |
| 121 | - return $.del([path.join(conf.paths.docs, '/')]); | |
| 124 | + return $.del([path.join(conf.paths.docs, '/')]); | |
| 122 | 125 | }); |
| 123 | 126 | |
| 124 | 127 | gulp.task('noosfero', ['html'], function () { |
| 125 | 128 | var layouts = gulp.src('layouts/**/*') |
| 126 | 129 | .pipe(gulp.dest(path.join(conf.paths.dist, "layouts"))); |
| 127 | 130 | var theme = gulp.src('theme.yml') |
| 131 | + .pipe(insert.prepend('name: "' + themeName + '"\n')) | |
| 128 | 132 | .pipe(gulp.dest(conf.paths.dist)); |
| 129 | 133 | var index = gulp.src(path.join(conf.paths.dist, 'index.html')) |
| 130 | 134 | .pipe(rename('index.html.erb')) | ... | ... |
gulp/conf.js
| ... | ... | @@ -22,7 +22,7 @@ exports.paths = { |
| 22 | 22 | themes: 'themes' |
| 23 | 23 | }; |
| 24 | 24 | exports.configTheme = function(theme) { |
| 25 | - exports.paths.theme = path.join(exports.paths.themes, theme || "default"); | |
| 25 | + exports.paths.theme = theme || "angular-default"; | |
| 26 | 26 | exports.paths.allSources = [exports.paths.src, exports.paths.theme]; |
| 27 | 27 | exports.paths.dist = path.join("dist", exports.paths.theme); |
| 28 | 28 | } | ... | ... |
package.json
| ... | ... | @@ -8,7 +8,7 @@ |
| 8 | 8 | "ng-forward": "0.0.1-alpha.12" |
| 9 | 9 | }, |
| 10 | 10 | "config": { |
| 11 | - "theme": "default" | |
| 11 | + "theme": "angular-default" | |
| 12 | 12 | }, |
| 13 | 13 | "scripts": { |
| 14 | 14 | "build": "webpack; gulp clean && gulp --theme=$npm_package_config_theme build", |
| ... | ... | @@ -46,6 +46,7 @@ |
| 46 | 46 | "gulp-eslint": "~1.0.0", |
| 47 | 47 | "gulp-filter": "~3.0.1", |
| 48 | 48 | "gulp-flatten": "~0.2.0", |
| 49 | + "gulp-insert": "^0.5.0", | |
| 49 | 50 | "gulp-inject": "~3.0.0", |
| 50 | 51 | "gulp-load-plugins": "~0.10.0", |
| 51 | 52 | "gulp-minify-css": "~1.2.1", | ... | ... |
theme.yml
themes/default/.keep