UNPKG

hck2-dev

Version:

Development Tools For HCK2

94 lines (67 loc) 2.74 kB
// Set Variables In Config.js const hck2 = require('hck2-dev'); // @Command: "gulp start" gulp.task('start', () => { setTimeout(hck2.start, 0); }); // @Command: "gulp jigsaw" (Install Jigsaw) // @Command: "gulp" (run) hck2.gulp.task('jigsaw', () => { return hck2.jigsaw(); }); // @Command: "gulp sass" or "gulp sass --prod" hck2.gulp.task('sass', () => hck2.SASS()); // @Command: "gulp js" or "gulp js --prod" hck2.gulp.task('js', () => hck2.JS()); // @Command: "gulp prod" for executing both "gulp js --prod" & "gulp sass --prod" hck2.gulp.task('prod', () => { process.argv += ' --prod'; hck2.JS(); hck2.SASS(); }); // @Command: "gulp watch" hck2.gulp.task('watch', () => { hck2.gulp.start('sass'); hck2.gulp.start('js'); hck2.WATCH(); }); // @Command: "gulp" (same as "gulp start") hck2.gulp.task('default', () => process.argv.length > 2 ? hck2.commands(process.argv, config) : hck2.gulp.start('start')); // @Command: "gulp image" hck2.gulp.task('image', () => hck2.image()); // @Command: "gulp sitespeed" hck2.gulp.task('sitespeed', () => sitespeed()); // @Command: "gulp minify" (dest: location + '/Minified') hck2.gulp.task('minify', function () { hck2.minify([ 'https://google.com', 'cnn.com', 'https://twitter.com/about' ]); }); // @Command: "gulp access" hck2.gulp.task('access', function () { // Enter URL or path to .html file var url = 'https://www.couchsurfing.com/'; // WCAG2A, WCAG2AA, WCAG2AAA, and Section508 var accessibilityLevel = 'WCAG2AA'; var reportLevels = { notice: false, warning: true, error: true } hck2.accessibility(url, accessibilityLevel, reportLevels); }); // @Command: "gulp stress" hck2.gulp.task('stress', function () { var url = 'https://www.example.com'; var concurrent = 10; var requestsPerSecond = 5; var maxSeconds = 30; hck2.stressTest(url, concurrent, requestsPerSecond, maxSeconds); }); // @Command: "gulp critical" hck2.gulp.task('critical', function () { var stylesheet = './public/css/app.css'; var output = './public/css/'; //critical.css var url = 'https://example.com'; var width = 1300; var height = 900; hck2.criticalCSS(stylesheet, output, url, width, height); }); // @Command: "gulp sprites" hck2.gulp.task('sprites', function () { var input = './src/images/*.png'; var output = './src/images/output/'; hck2.sprites(input, output); }); // @Command: "gulp copy" hck2.gulp.task('copy', () => { require('child_process').exec('npm run postinstall --prefix node_modules/hck2-dev', (err, stdout, stderr) => console.log(stdout)); });