Commit d66d01d8d54b55423e6f305d3d90cb3f99ba3c28
1 parent
dce2b87d
Exists in
master
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
11 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,19 @@ 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 | + console.log(conf.paths.dist); | |
121 | + return $.del(["dist", path.join(conf.paths.tmp, '/')]); | |
118 | 122 | }); |
119 | 123 | |
120 | 124 | gulp.task('clean-docs', [], function() { |
121 | - return $.del([path.join(conf.paths.docs, '/')]); | |
125 | + return $.del([path.join(conf.paths.docs, '/')]); | |
122 | 126 | }); |
123 | 127 | |
124 | 128 | gulp.task('noosfero', ['html'], function () { |
125 | 129 | var layouts = gulp.src('layouts/**/*') |
126 | 130 | .pipe(gulp.dest(path.join(conf.paths.dist, "layouts"))); |
127 | 131 | var theme = gulp.src('theme.yml') |
132 | + .pipe(insert.prepend('name: "' + themeName + '"\n')) | |
128 | 133 | .pipe(gulp.dest(conf.paths.dist)); |
129 | 134 | var index = gulp.src(path.join(conf.paths.dist, 'index.html')) |
130 | 135 | .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