gulp-js1k

2019-10-11 admin

gulp-js1k是什么

什么是gulp-js1k,Gulp plugin for minifying and verifying for js1k

gulp-js1k使用教程帮助文档

gulp-js1k

Automatically minify, print some stats about your code size and shove your code into a shim so you can open it in the browser for the js1k competition.

Usage:

$ npm install gulp-js1k

Add it to your gulp file: (gulpfile.js)

var js1k = require("gulp-js1k");

// Print some stats (js1k elgibility), minify and output to "/submission/"
gulp.task("js1k", function() {
	gulp.src("js1k-app.js")
		.pipe(js1k())
		.pipe(gulp.dest("./submission/"));
});

// Print some stats (js1k elgibility), minify, output to "/submission/" with the shim html file 
gulp.task("js1k-with-shim", function() {
	gulp.src("js1k-app.js")
		.pipe(js1k(true)) // Notice the true
		.pipe(gulp.dest("./submission"));
});

Run gulp <task-name> and done!

File greater that 1k?

[gulp] gulp-js1k ✘ Minified code is greater than 1024 bytes. 530 characters over the limit (1554 bytes in size).

File less than 1k?

[gulp] gulp-js1k ✔ Less than 1024 bytes. 102 characters left (922 bytes in size). Good to go.

License: MIT

本站文章除注明转载外,均为本站原创或编译。欢迎任何形式的转载,但请务必注明出处。

转载请注明:文章转载自 JavaScript中文网 [https://www.javascriptcn.com]

本文地址:https://www.javascriptcn.com/read-77153.html

文章标题:gulp-js1k

回到顶部