Beispiel #1
0
	handlebarsExists(function(err) {
		if (err) {

			gulp.src('src/index.html')
				.pipe(gulp.dest('.tmp'))
				.pipe(gcallback(function() {
					cb();
				}));

		} else {

			gulp.src(srcIndex)
				.pipe(hb({
					data: 'src/data/*.json',
					helpers: 'src/html/helpers/*.js',
					partials: 'src/html/partials/**/*.hbs',
					bustCache: true,
					debug: false
				}))
				.pipe(rename('index.html'))
				.pipe(gulp.dest('.tmp'))
				.pipe(gcallback(function() {
					cb();
				}));
		}
	});
Beispiel #2
0
	handlebarsExists(function(err) {
		if(err) {
			cb();
		} else {
			// if you need to select a subset of data based on command line arg
			// var data = fs.readFileSync(srcCopy, {encoding: 'utf8'});
			// data = JSON.parse(data);
			gulp.src(srcIndex)
				.pipe(plumber({
			        errorHandler: function (err) { console.log(err); this.emit('end'); }
			    }))	
				 .pipe(hb({
		            data: 'src/data/*.json',
		            helpers: 'src/html/helpers/*.js',
		            partials: 'src/html/partials/**/*.hbs',
		            bustCache: true,
		            debug: false
		        }))
				.pipe(rename('index.html'))
				.pipe(gulp.dest('src'))
				.pipe(gcallback(function() {
	    			cb();
				}));
		}
	});
Beispiel #3
0
gulp.task('bundle-manifest-routes', function() {
  var sections = [];
  gulp.src('./components/*/manifest.json')
      .pipe(foreach (function(stream, file) {
        var component = manifestDirectory(file);
        var manifestFile = require(file.path);
        var routes = [];
        if (manifestFile.routes) {
          manifestFile.routes.forEach(function(r) {
            // Hacky deep copy. Modifying manifestFile here will be repeated
            // each time the task is called (consider watch/reload) due to
            // cached file reads.
            var route = JSON.parse(JSON.stringify(r));
            if (route.url) {
              route.url = '/' + component + route.url;
            }
            routes.push(route);
          });
        }
        sections = sections.concat(routes);
        return stream;
      }))
      .pipe(gcallback(function() {
        var output_sections = JSON.stringify(sections);
        var _file_contents = 'app.constant("manifestRoutes", ' + output_sections + ');\n';
        stringSrc("sections.js", _file_contents).pipe(gulp.dest("js"));
      }));
});
 return gulp.watch(tsFiles, function(file) {
     done = false;
     // console.log('Compiling ' + file.path + '...');
     return compileTs(file.path, true).pipe(gcallback(function() {
         if (!done) {
             done = true;
             // console.log('Finished Compiling ' + file.path + '...');
         }
     }));
 });
Beispiel #5
0
gulp.task('css', function (cb) {
  gulp.src(cfg.cssPath + '/**/*.scss')
  .pipe(sourcemaps.init())
  .pipe(sass({
    outputStyle: 'compressed'
  }).on('error', sass.logError))
  .pipe(sourcemaps.write())
  .pipe(gulp.dest(cfg.cssBuildPath))
  .pipe(gcallback(cb));
});
Beispiel #6
0
gulp.task('haml', function() {
  var glob = argv.file || './*.haml'
  var dest = '.'
  gulp.src(glob).
    pipe(plumber({
      onError: onError
    })).
    pipe(haml()).
    pipe(gulp.dest(dest)).
    pipe(gcallback(function() {
        console.log("HAML DONE")
        reload()
      }))
})
Beispiel #7
0
gulp.task('require', ["clean", "index"], function(done){

  return rjs({
      baseUrl: 'source',
      mainConfigFile: 'source/config.js',
      out: 'all.js',
      name: 'init',
      findNestedDependencies: true
    })
    .pipe(uglify({compress: true}))
    .pipe(gulp.dest('www/js/'))
    .pipe(gcallback(done));

});
Beispiel #8
0
gulp.task('haml-watch', function() {
  var dest = '.'
  gulp.src('./*.haml').
    pipe(plumber({
      onError: onError
    })).
    pipe(watch('./*.haml')).
    pipe(changed(dest, {extension: '.html'})).
    pipe(haml()).
    pipe(gulp.dest(dest)).
    pipe(gcallback(function() {
        console.log("HAML DONE")
        reload()
      }))
})
Beispiel #9
0
gulp.task('test', function() {
	connect.server({
		root : ['build'],
		port : 18000
	})

	return gulp.src(['tests/**.js'])
		.pipe(dalek({
			browser : ['phantomjs'],
			reporter : ['console', 'html']
		}))
		.pipe(gcb(function() {
			connect.serverClose();
		}))
})
Beispiel #10
0
gulp.task('js', function(cb){
  gulp.src([
    //You can add important files first like libraries so they'll be on the beginning of the main file
    cfg.jsPath + "/example.js",  //(Unlimited) Important stuff first
    cfg.jsPath + '/**/*.js'     //All the other files
  ])

  //You can ignore js lint on library files using /*ignore jslint start */ and /*ignore jslint end */
  .pipe(jshint({
    browser: true,
  }))

  .pipe(concat('app.js'))
  .pipe(gulp.dest(cfg.jsBuildPath))
  .pipe(gcallback(cb));
});
Beispiel #11
0
gulp.task('bundle-manifest', function() {
  var components = [];
  var namespace = [];
  gulp.src('./components/*/manifest.json')
      .pipe(foreach (function(stream, file) {
        var component = manifestDirectory(file);
        components.push(component);
        namespace.push(changeCase.camelCase(component));
        return stream;
      }))
      .pipe(gcallback(function() {
        var tabs = [];
        components.forEach(function(component) {
          tabs.push({component: component, title: changeCase.titleCase(component)});
        });
        stringSrc("tabs.js", 'app.value("tabs", ' + JSON.stringify(tabs) + ');').pipe(gulp.dest("js"));
        var _appNS = 'kubernetesApp.components.';
        var _appSkeleton = require('./js/app.skeleton.json');
        stringSrc("app.preinit.js",
                  _appSkeleton.appSkeleton.replace('%s', '"' + _appNS + namespace.join('", "' + _appNS) + '"'))
            .pipe(gulp.dest("js"));
      }));
});