Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log( 'Compiling templates...' );
gulp.src( sourcePaths.libraryTemplates )
.pipe( rename( function ( path ) {
path.dirname = 'templates';
} ) )
.pipe( templateCache( libraryName + '-templates.js', {
module: libraryTemplatesModule,
standalone: true,
root: '/' + libraryName + '/'
} ) )
.pipe( gulp.dest( buildPaths.root ) );
} );
gulp.task( 'compile-library-styles', function () {
console.log( 'Compiling styles...' );
gulp.src( sourcePaths.libraryStyles )
// The onerror handler prevents Gulp from crashing when you make a mistake in your SASS
.pipe(sourcemaps.init())
.pipe( sass( {
errLogToConsole: true,
sourceComments: 'map'
} ) )
.pipe(sourcemaps.write())
.pipe( rename( function ( path ) {
path.dirname = '';
} ) )
.pipe( concat( libraryName + '.css' ) )
.pipe( gulp.dest( buildPaths.root ) );
gulp.task('basic', function() {
console.log('Toto je task.');
});
/* gulp-src (minimatch) */
gulp.task('src', function() {
var result = gulp.src('input/*.+(js|txt)');
console.log('src', result);
});
/* gulp-dest (vinyl) */
gulp.task('dest', function() {
gulp.src('input/**/*')
.pipe(gulp.dest('output'));
});
/* gulp-watch */
gulp.task('watch', function() {
gulp.watch('input/*', function(event) {
console.log('event', event.type, event.path);
});
});
/* watch and call task */
import inky from 'inky';
import fs from 'fs';
import siphon from 'siphon-media-query';
import path from 'path';
import merge from 'merge-stream';
const $ = plugins();
// Look for the --production flag
const PRODUCTION = !!(yargs.argv.production);
const EMAIL = yargs.argv.to;
gulp.task('build',
gulp.series(clean, pages, sass, images, inline, cleanCSS));
gulp.task('default',
gulp.series('build', server, watch));
gulp.task('zip',
gulp.series('build', zip));
function clean(done) {
rimraf('dist', done);
}
function cleanCSS(done) {
rimraf('dist/css', done);
}
// Compile layouts, pages, and partials into flat HTML files
// Then parse using Inky templates
function pages() {
// Update path for OSX
if (platform === 'osx') destPath += 'node-webkit.app/Contents/Frameworks/node-webkit Framework.framework/Libraries';
// Copy lib
return gulp.src('./deps/ffmpegsumo/'+platform+'/*')
.pipe(gulp.dest(destPath));
});
gulp.task('install', ['compile', 'install:ffmpegsumo']);
/* --------------------------------------
* Tasks to package this app
* -------------------------------------- */
gulp.task('build', ['compile'], function(cb) {
// Read package.json
var package = require('./package.json');
// Find out which modules to include
var modules = [];
if (!!package.dependencies) {
modules = Object.keys(package.dependencies)
.filter(function(m) { return m !== 'nodewebkit'; })
.map(function(m) { return './node_modules/'+m+'/**/*'; });
}
// Which platforms should we build
var platforms = [];
if (process.argv.indexOf('--all') > -1) {
'js:babel',
),
);
// Default tasks
gulp.task(
'default',
gulp.series(
'clean',
'copy',
'build',
),
);
// Development tasks
gulp.task(
'dev',
gulp.series(
'default',
'watch',
),
);
gulp.task('test', [ 'version' ], function () {
return gulp.src('test-src/index.html')
.pipe(qunit());
});
gulp.task('minify', [ 'version' ], function () {
return gulp.src(srcFile)
.pipe(size({ showFiles: true }))
.pipe(uglify())
.pipe(rename('logger.min.js'))
.pipe(size({ showFiles: true }))
.pipe(gulp.dest('src'));
});
gulp.task('release', [ 'push_tag', 'publish_npm' ]);
gulp.task('push_tag', function (done) {
git.tag(version, 'v' + version);
git.push('origin', 'master', {args: " --tags"}, function (err) {
done(err);
});
});
gulp.task('publish_npm', function (done) {
spawn('npm', [ 'publish' ], { stdio: 'inherit' })
.on('close', done);
});
gulp.task('default', [ 'version', 'lint', 'test', 'minify' ]);
var DEBUG = process.env.NODE_ENV === 'debug',
CI = process.env.CI === 'true';
var banner = '/*! <%= pkg.name %> v<%= pkg.version %>, @license <%= pkg.license %>, @link <%= pkg.homepage %> */\n';
var uglifyOptions = {
compress: {
drop_console: true
},
mangle: {
except: ['HeadTable', 'NameTable', 'CmapTable', 'HheaTable', 'MaxpTable', 'HmtxTable', 'PostTable', 'OS2Table', 'LocaTable', 'GlyfTable']
}
};
gulp.task('default', [/*'lint',*/ 'test', 'build', 'buildFonts']);
gulp.task('build', function () {
var pkg = require('./package.json');
return gulp.src('src/browser-extensions/pdfMake.js')
.pipe(webpack(require('./webpack.config.js'), null, reportWebPackErrors))
.pipe(replace(/\/[*/][@#]\s+sourceMappingURL=((?:(?!\s+\*\/).)*).*\n/g, ''))
.pipe(header(banner, {pkg: pkg}))
.pipe(gulp.dest('build'))
.pipe(sourcemaps.init())
.pipe(uglify(uglifyOptions))
.pipe(header(banner, {pkg: pkg}))
.pipe(rename({extname: '.min.js'}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('build'));
});
function reportWebPackErrors(err, stats) {
done();
} else {
done('missing `--rule` option');
}
});
gulp.task('lint', function lint() {
return gulp
.src(SRC_FOLDER)
.pipe(tslint({
formatter: 'stylish',
}))
.pipe(tslint.report());
});
gulp.task('self-lint', function selfLint() {
return gulp
.src(SRC_FOLDER)
.pipe(tslint({
configuration: 'tslint_eslint_rules.json',
formatter: 'verbose'
}))
.pipe(tslint.report());
});
gulp.task('build', argv.lint === false ? [] : ['lint'], function build(done) {
var hasError = false;
gulp
.src([SRC_FOLDER, DEF_FOLDER])
.pipe(sourcemaps.init())
.pipe(tsProject())
.on('error', function onError() {
'trivial-components.min.js': {
'maxSize': 100000,
'maxGzippedSize': 20000
},
'trivial-components.min.css': {
'maxSize': 25000,
'maxGzippedSize': 5000
},
'*': {
maxTotalSize: 125000,
maxTotalGzippedSize: 25000
}
}));
});
gulp.task('default', ['zip', 'tar', "less-demo", "size-report"]);
gulp.task('watch', function () {
livereload.listen();
gulp.watch(['less/*.less', 'demo/less/*.less'], ["less-demo", 'less', 'less-bootstrap']);
});
gulp.task('watch-ts', function () {
gulp.watch(['ts/*.ts', 'demo/ts/*.ts'], ['js-single', 'typescript-demo']);
});
var tsProject = ts.createProject('tsconfig.json');
gulp.task('typescript', [], function () {
var tsResult = tsProject.src()
.pipe(sourcemaps.init())
.pipe(tsProject());
.pipe(mocha({
reporter: 'dot'
}))
});
gulp.task("tslint", () => {
return gulp.src(["src/**/*.ts", '!src/**/*.d.ts'])
.pipe(tslint({
configuration: "./tslint.json"
}))
.pipe(tslint.report());
}
);
gulp.task('dist', ['tslint', 'compile-dist', 'test-dist']);
gulp.task("default", ["tslint", "compile", "test"]);