Commit 33544a8b322f9324c61dcb42d3e067b873ccc952

Authored by Victor Costa
Committed by Michel Felipe
1 parent 4b4877ed

Add plugins in gulp build

gulp/build.js
... ... @@ -16,25 +16,31 @@ var $ = require('gulp-load-plugins')({
16 16 });
17 17  
18 18 gulp.task('partials', function () {
19   - var srcPaths = [path.join(conf.paths.tmp, '/serve/app/**/*.html')];
20   - conf.paths.allSources.forEach(function(src) {
21   - srcPaths.push(path.join(src, '/app/**/*.html'));
  19 + var merged = merge();
  20 + ['app', conf.paths.plugins].forEach(function(partialPath) {
  21 + var srcPaths = [path.join(conf.paths.tmp, '/serve/app/**/*.html')];
  22 + conf.paths.allSources.forEach(function(src) {
  23 + srcPaths.push(path.join(src, partialPath, '/**/*.html'));
  24 + });
  25 + merged.add(gulp.src(srcPaths)
  26 + .pipe($.minifyHtml({
  27 + empty: true,
  28 + spare: true,
  29 + quotes: true
  30 + }))
  31 + .pipe($.angularTemplatecache('templateCacheHtml-'+partialPath+'.js', {
  32 + module: 'noosferoApp',
  33 + root: partialPath
  34 + }))
  35 + .pipe(gulp.dest(conf.paths.tmp + '/partials/')));
22 36 });
23   - return gulp.src(srcPaths)
24   - .pipe($.minifyHtml({
25   - empty: true,
26   - spare: true,
27   - quotes: true
28   - }))
29   - .pipe($.angularTemplatecache('templateCacheHtml.js', {
30   - module: 'noosferoApp',
31   - root: 'app'
32   - }))
33   - .pipe(gulp.dest(conf.paths.tmp + '/partials/'));
  37 + return merged;
34 38 });
35 39  
36 40 gulp.task('html', ['inject', 'partials'], function () {
37   - var partialsInjectFile = gulp.src(path.join(conf.paths.tmp, '/partials/templateCacheHtml.js'), { read: false });
  41 + var partialsInjectFile = gulp.src([
  42 + path.join(conf.paths.tmp, '/partials/templateCacheHtml-app.js'),
  43 + path.join(conf.paths.tmp, '/partials/templateCacheHtml-plugins.js')], { read: false });
38 44 var partialsInjectOptions = {
39 45 starttag: '<!-- inject:partials -->',
40 46 ignorePath: path.join(conf.paths.tmp, '/partials'),
... ...
gulp/conf.js
... ... @@ -15,6 +15,7 @@ var path = require(&#39;path&#39;);
15 15 */
16 16 exports.paths = {
17 17 src: 'src',
  18 + plugins: 'plugins',
18 19 dist: 'dist',
19 20 tmp: '.tmp',
20 21 e2e: 'e2e',
... ...
gulp/styles.js
... ... @@ -31,6 +31,7 @@ var buildStyles = function() {
31 31 ];
32 32 conf.paths.allSources.forEach(function(src) {
33 33 srcPaths.push(path.join(src, '/app/**/*.scss'));
  34 + srcPaths.push(path.join(src, conf.paths.plugins, '/**/*.scss'));
34 35 });
35 36 var injectFiles = gulp.src(srcPaths, { read: false });
36 37  
... ...
gulp/watch.js
... ... @@ -14,13 +14,11 @@ gulp.task(&#39;watch&#39;, [&#39;inject&#39;], function () {
14 14  
15 15 gulp.watch([path.join(conf.paths.src, '/*.html'), 'bower.json'], ['inject-reload']);
16 16  
17   - var stylePaths = [];
18   - conf.paths.allSources.forEach(function(src) {
19   - stylePaths.push(path.join(src, '/app/**/*.css'));
20   - stylePaths.push(path.join(src, '/app/**/*.scss'));
21   - });
22   -
23   - gulp.watch(stylePaths, function(event) {
  17 + gulp.watch([
  18 + path.join(conf.paths.src, '/app/**/*.css'),
  19 + path.join(conf.paths.src, '/app/**/*.scss'),
  20 + path.join(conf.paths.src, conf.paths.plugins, '/**/*.scss')
  21 + ], function(event) {
24 22 if(isOnlyChange(event)) {
25 23 gulp.start('styles-reload');
26 24 } else {
... ... @@ -39,6 +37,7 @@ gulp.task(&#39;watch&#39;, [&#39;inject&#39;], function () {
39 37 var watchPaths = [];
40 38 conf.paths.allSources.forEach(function(src) {
41 39 watchPaths.push(path.join(src, '/app/**/*.html'));
  40 + watchPaths.push(path.join(src, conf.paths.plugins, '/**/*.html'));
42 41 });
43 42 gulp.watch(watchPaths, function(event) {
44 43 browserSync.reload(event.path);
... ...