Example #1
0
        gulp.task('build:' + name + ':less', function() {
            var buildSourceFilePath = './build/less/' + build.filename + '.less';
            var destPath = getBuildPath(build, 'css');

            mkdirp.sync('./build/less/');
            fs.writeFileSync(buildSourceFilePath, lessFileContent);

            if(name === 'colorset.less2js') {
                return gulpBuildColorsetJS(build, buildSourceFilePath, bannerContent);
            }

            return gulp.src(buildSourceFilePath)
                .pipe(less())
                .pipe(autoprefixer({
                    browsers: ["Android 2.3",
                        "Android >= 4",
                        "Chrome >= 20",
                        "Firefox >= 24",
                        "Explorer >= 8",
                        "iOS >= 6",
                        "Opera >= 12",
                        "Safari >= 6"],
                    cascade: true
                }))
                .pipe(csscomb())
                .pipe(header(bannerContent))
                .pipe(chmod(644))
                .pipe(gulp.dest(destPath))
                .on('end', function() {
                    console.log('     css > '.yellow.bold + (destPath + build.filename + '.css').italic.underline);
                })
                //.pipe(sourcemaps.init())
                .pipe(cssmin({
                    compatibility: 'ie8',
                    keepSpecialComments: '*',
                    sourceMap: true,
                    advanced: false
                }))
                .pipe(rename({
                    suffix: '.min'
                }))

                //.pipe(sourcemaps.write())
                .pipe(chmod(644))
                .pipe(gulp.dest(destPath))
                .on('end', function() {
                    console.log('     css > '.yellow.bold + (destPath + build.filename + '.min.css').italic.underline);
                });
        });
Example #2
0
gulp.task('copy-styles', function() {
    return merge(
        gulp.src(config.files.vendor.css)
            .pipe(chmod(644))
            .pipe(gulp.dest(dist_dir + '/assets/css')),

        gulp.src(config.files.vendor.fonts)
            .pipe(chmod(644))
            .pipe(gulp.dest(dist_dir + '/assets/fonts')),

        gulp.src(config.files.vendor.images)
            .pipe(chmod(644))
            .pipe(gulp.dest(dist_dir + '/assets/images'))
    );
});
Example #3
0
gulp.task('copy-style', function() {
    gulp.src(config.files.vendor.css)
        .pipe(vendor('vendor.css'))
        .pipe(environments.production(uglifycss()))
        .pipe(chmod(644))
        .pipe(gulp.dest('static/assets/css'));

    gulp.src(config.files.vendor.fonts)
        .pipe(chmod(644))
        .pipe(gulp.dest('static/assets/fonts'));

    gulp.src(config.files.vendor.images)
        .pipe(chmod(644))
        .pipe(gulp.dest('static/assets/images'));
});
Example #4
0
gulp.task('min-css',['css'], function () {
   return gulp.src(path.join(buildDir,"msa.css"))
   .pipe(minifyCSS())
   .pipe(rename('msa.min.css'))
   .pipe(chmod(644))
   .pipe(gulp.dest(buildDir));
});
gulp.task('html', ['clean:html'], function() {
  return gulp.src('src/index.adoc')
    .pipe(isDist ? through() : plumber())
    // NOTE using stdin here would cause loss of context
    .pipe(exec('bundle exec asciidoctor-bespoke -o - src/index.adoc', { pipeStdout: true }))
    .pipe(exec.reporter({ stdout: false }))
    .pipe(through(function(file) {
      var html = file.contents.toString()
        // hide inline SVGs
        .replace(new RegExp('<svg[^>]*>[\\s\\S]*?</svg>', 'g'), '<![CDATA[$&]]>');
      html = tidy(html, tidyOpts) // NOTE based on tidy 4.9.26
        // restore inline SVGs
        .replace(new RegExp('<!\\[CDATA\\[(<svg[^>]*>[\\s\\S]*?</svg>)\\]\\]>', 'g'), '$1')
        // strip extra newlines inside <pre> tags (fixed in tidy 5.1.2)
        .replace(new RegExp('<pre([^>]*)>\\n([\\s\\S]*?)\\n</pre>', 'g'), '<pre$1>$2</pre>\n')
        // strip extra newline after <script> start tag for empty and single-line content
        .replace(new RegExp('>\\n(?:(.+)\\n)?</script>', 'g'), '>$1</script>')
        // add newline before <script> tags
        .replace(new RegExp('><script([^>]*)>', 'g'), '>\n<script$1>');
      file.contents = new Buffer(html);
      this.push(file);
    }))
    .pipe(rename('index.html'))
    .pipe(chmod(644))
    .pipe(gulp.dest('dist'))
    .pipe(connect.reload());
});
Example #6
0
gulp.task('hooks', function() {
    gulp.src('hooks/*')
        .pipe(chmod({
            execute: true
        }))
        .pipe(gulp.dest('.git/hooks/'));
});
Example #7
0
gulp.task('bin', () => {
  return gulp.src(paths.bin)
  .pipe(cache('bin'))
  .pipe(babel())
  .pipe(chmod(755))
  .pipe(gulp.dest('dist/bin'))
})
Example #8
0
 build.bins.map(bin =>
   gulp
     .src(path.join(DIST, build.package, 'lib', bin.entry))
     .pipe(buildDist(bin.output, bin, /* isProduction */ false))
     .pipe(header(SCRIPT_HASHBANG + PRODUCTION_HEADER))
     .pipe(chmod(0o755))
     .pipe(gulp.dest(path.join(DIST, build.package, 'bin')))
        function (answers) {
            answers.appNameSlug = _.slugify(answers.appName);

            var srcPaths = [
              __dirname + '/templates/**', 
              __dirname + '/templates/.bowerrc',
              __dirname + '/templates/.editorconfig',
              __dirname + '/templates/.gitignore',
              '!' + __dirname + '/templates/.gradle',
              '!' + __dirname + '/templates/bin',
              '!' + __dirname + '/templates/bin/**',
              '!' + __dirname + '/templates/build',
              '!' + __dirname + '/templates/build/**'
            ];

            if (answers.appTestRestPort == 0) {
              srcPaths.push('!' + __dirname + '/templates/src/test');
              srcPaths.push('!' + __dirname + '/templates/src/test/**');
            }

            gulp.src(srcPaths)
                .pipe(gulpif(isTemplateable, template(answers, templateOptions)))
                .pipe(rename(function (file) {
                    if (file.basename[0] === '_') {
                        file.basename = '.' + file.basename.slice(1);
                    }
                }))
                .pipe(gulpif(isExecutable, chmod(755)))
                .pipe(conflict('./'))
                .pipe(gulp.dest('./'))
                .pipe(install())
                .on('end', function () {
                    done();
                });
        });
Example #10
0
gulp.task('copy-script', function() {
    gulp.src(config.files.vendor.js)
        .pipe(vendor('vendor.js'))
        .pipe(environments.production(uglify()))
        .pipe(chmod(644))
        .pipe(gulp.dest('static/assets/js'));
});
Example #11
0
gulp.task('build-test',['init'], function() {
  var b = browserify({debug: true});
  return b.bundle()
    .pipe(source("test.js"))
    .pipe(chmod(644))
    .pipe(gulp.dest(buildDir));
});
gulp.task('html', function () {
    gulp.src(buildConfig.srcFolder + '/app/**/*.html')
        // And put it in the dist folder
        //.pipe(removeHtmlComments())
        .pipe(chmod(755))
        .pipe(gulp.dest(buildConfig.distFolder + '/app'));
});
Example #13
0
gulp.task('build-min-css',['build-css'], function () {
   return gulp.src(join(buildDir, outputFile + '.css'))
   .pipe(minifyCSS())
   .pipe(rename(outputFile + '.min.css'))
   .pipe(chmod(644))
   .pipe(gulp.dest(buildDir));
});
Example #14
0
gulp.task( 'v1-jigyosyo', ['download'], function () {
  gulp.src( 'api/JIGYOSYO.CSV' )
    .pipe( jigyosyo2json() )
    .pipe( v1() )
    .pipe( chmod( 644 ) )
    .pipe( gulp.dest( 'api/v1' ) );
} );
Example #15
0
gulp.task("compile-ts", function ()
{
    var tsProject = ts.createProject(
        './src/tsconfig.json',
        {
            sortOutput: true,
            typescript: require('typescript')    // must a project package dependency
        });

    var tsResult =
        tsProject.src(['src/**/*.ts', 'typings/index.d.ts'], { base: 'src' })
            .pipe(sourcemaps.init())
           // .pipe(insert.prepend('"use strict";'))
            .pipe(ts(tsProject));

    var mainFilter = filter('main.js', {restore:true});
    
    return merge([
            tsResult.dts
                .pipe(concat('index.d.ts'))
                .pipe(gulp.dest('lib')),
            tsResult.js
                .pipe(mainFilter)
                .pipe(chmod(755))
                .pipe(mainFilter.restore)
                //       .pipe(concat('index.js'))
                .pipe(sourcemaps.write('.', {includeContent:false, sourceRoot: rootDir}))
                .pipe(gulp.dest('lib'))
        ]
    );
});
Example #16
0
gulp.task( 'v1', [ 'download' ], function () {
  gulp.src( 'api/KEN_ALL_ROME.CSV' )
    .pipe( postal2json() )
    .pipe( v1() )
    .pipe( chmod( 644 ) )
    .pipe( gulp.dest( 'api/v1' ) );
} );
Example #17
0
		gulp.task(options.taskName, options.taskDeps, () => {
			let chain = gulp.src(options.src)
				.pipe(cache(options.taskName))
				.pipe(plumber());

			if (options.changed) {
				chain = chain.pipe(changed(options.dest, options.changed));
			}

			if (options.replace) {
				chain = chain.pipe(replace(options.replace));
			}

			if (options.rename) {
				chain = chain.pipe(rename(options.rename));
			}

			if (!_isUndefined(options.chmod)) {
				chain = chain.pipe(chmod(options.chmod));
			}

			chain = chain.pipe(gulp.dest(options.dest));

			_forEach(options.globalBrowserSyncs, (bs) => {
				chain = chain.pipe(bs.stream());
			});

			return chain;
		});
Example #18
0
gulp.task('sassFrontend', function () {
  gulp.src(inputFrontend)
      .pipe(sass({sourceComments: 'map'}))
      .pipe(chmod(755))
      .pipe(gulp.dest('app/css'))
      .pipe(browserSync.reload({stream:true}));
});
Example #19
0
gulp.task('build-browser', function() {
  var b = browserify({debug: true, hasExports: true});
  exposeBundles(b);
  return b.bundle()
    .pipe(source(outputFile + ".js"))
    .pipe(chmod(644))
    .pipe(gulp.dest(buildDir));
});
Example #20
0
 ], function(file) {
   // copy assets
   gulp.src(file.path, { base: source.themes })
     .pipe(gulpif(config.hasPermission, chmod(config.permission)))
     .pipe(gulp.dest(output.themes))
     .pipe(print(log.created))
   ;
 })
Example #21
0
gulp.task( 'adminJS', ['clean'], function() {
	return gulp.src( paths.adminScripts )
		// This will minify and rename to *.min.js
		.pipe( uglify() )
		.pipe( rename({ extname: '.min.js' }) )
		.pipe( chmod( 644 ) )
		.pipe( gulp.dest( 'assets/js/admin' ) );
});
Example #22
0
gulp.task('images', function(){
	return gulp.src(config.images + '**/*.+(png|jpg|gif|svg)')
	.pipe(imagemin({
      progressive: true
    }))
	.pipe(chmod(644))
	.pipe(gulp.dest(path.dist + 'img/'))
});
Example #23
0
gulp.task('build-scripts', ['build-html'], function() {
    return merge(
        gulp.src(config.files.script.concat([tmp_dir + '/templates.js']))
            .pipe(concat('facette.js'))
            .pipe(header(config.banner + '\n(function() {\n\n"use strict";\n\n', {pkg: config.pkg}))
            .pipe(footer('\n}());\n'))
            .pipe(environments.production(uglify({mangle: false, preserveComments: 'license'})))
            .pipe(chmod(644))
            .pipe(gulp.dest(dist_dir + '/assets/js')),

        gulp.src(config.files.vendor.js)
            .pipe(vendor('vendor.js'))
            .pipe(environments.production(uglify({preserveComments: 'license'})))
            .pipe(chmod(644))
            .pipe(gulp.dest(dist_dir + '/assets/js'))
    );
});
Example #24
0
gulp.task('sassAdmin', function () {
  return gulp.src('client/admin/sass/*.scss')
    .pipe(sass().on('error', sass.logError))
    .pipe(chmod(777))
    .pipe(cleanCSS({compatibility: 'ie8'}))
    .pipe(rename("style.min.css"))
    .pipe(gulp.dest('client/admin/css'));
});
Example #25
0
gulp.task('images', function () {
  return gulp.src(paths.development.img)
    .pipe(imagemin({ optimizationLevel : 3, progressive : true, interlaced : true }))
    .pipe(chmod(755))
    .pipe(gulp.dest(paths.production.img))
    .pipe(notify('Images task complete'))
    .pipe(connect.reload());
});
Example #26
0
gulp.task('scripts', function() {
  gulp.src(src.scripts)
    .pipe(uglify())
    .pipe(concat({ path: 'editor.min.js'}))
    .pipe(chmod(775))
    .pipe(gulp.dest(dist.scripts))
  ;
});
Example #27
0
gulp.task('useref', function(){
  return gulp.src(config.html)
	.pipe(useref())
    .pipe(gulpIf('*.js', uglify()))
    .pipe(gulpIf('*.css', cleanCSS()))
    .pipe(chmod(644))
	.pipe(gulp.dest(path.dist))
});
gulp.task('fonts', function () {
    gulp.src(buildConfig.srcFolder + '/assets/lib/**/*.{eot,svg,ttf,otf,woff,woff2}')
        .pipe(flatten())
        .pipe(dedupe({
            same: false
        }))
        .pipe(chmod(755))
        .pipe(gulp.dest(buildConfig.distFolder + '/assets/fonts'));
});
gulp.task('sass', function (done) {
    gulp.src(buildConfig.srcFolder + '/assets/scss/**/*.scss')
        .pipe(sass({
            errLogToConsole: true
        }))
        .pipe(chmod(755))
        .pipe(gulp.dest(buildConfig.srcFolder + '/assets/css'))
        .on('end', done);
});
Example #30
0
 function rebundle(ids){
   b.bundle()
   .on("error", function(error) {
     util.log(util.colors.red("Error: "), error);
    })
   .pipe(source(outputFile + ".js"))
   .pipe(chmod(644))
   .pipe(gulp.dest(buildDir));
 }