Ai
1 Star 0 Fork 0

叛道/drv.js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Gulpfile.js 2.27 KB
一键复制 编辑 原始数据 按行查看 历史
叛道 提交于 2015-06-17 16:16 +08:00 . Release v0.1.0
"use strict";
var os = require("os");
var gulp = require("gulp");
var gutil = require("gulp-util");
var jshint = require("gulp-jshint");
var uglify = require("gulp-uglifyjs");
var rename = require("gulp-rename");
var concat = require("gulp-concat");
var notify = require("gulp-notify");
var header = require("gulp-header");
var pkg = require("./package.json");
var dateFormat = require("dateformatter").format;
pkg.name = "Drv.js";
pkg.today = dateFormat;
var headerComment = ["/*",
" * <%= pkg.name %>",
" *",
" * @file <%= fileName(file) %> ",
" * @version <%= pkg.version %> ",
" * @description <%= pkg.description %>",
" * @license MIT License",
" * @author <%= pkg.author %>",
" * {@link <%= pkg.homepage %>}",
" * @updateTime <%= pkg.today('Y-m-d') %>",
" */",
"\r\n"].join("\r\n");
var headerMiniComment = "/*! <%= pkg.name %> v<%= pkg.version %> | <%= fileName(file) %> | <%= pkg.description %> | MIT License | By: <%= pkg.author %> | <%= pkg.homepage %> | <%=pkg.today('Y-m-d') %> */\r\n";
var srcFile = "./src/drv.js";
var distPath = "./dist";
gulp.task("js", function() {
return gulp.src(srcFile)
.pipe(jshint("./.jshintrc"))
.pipe(jshint.reporter("default"))
.pipe(header(headerComment, {pkg : pkg, fileName : function(file) {
var name = file.path.split(file.base);
return name[1].replace(/[\\\/]?/, "");
}}))
.pipe(gulp.dest(distPath))
.pipe(rename({ suffix: ".min" }))
.pipe(uglify()) //{outSourceMap: true}
.pipe(gulp.dest(distPath))
.pipe(header(headerMiniComment, {pkg : pkg, fileName : function(file) {
var name = file.path.split(file.base + ( (os.platform() === "win32") ? "\\" : "/") );
return name[1].replace(/[\\\/]?/, "");
}}))
.pipe(gulp.dest(distPath))
.pipe(notify({ message: "drv.js task complete" }));
});
gulp.task("watch", function() {
gulp.watch(srcFile, ["js"]);
});
gulp.task("default", function() {
gulp.run("js");
});
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/pandao/drv.js.git
git@gitee.com:pandao/drv.js.git
pandao
drv.js
drv.js
master

搜索帮助