0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-06 14:50:20 -05:00

Add template compilation to the gulp pipeline.

Just for avoid cache problems in production.
This commit is contained in:
Andrey Antukh 2016-02-28 10:12:25 +02:00
parent a9186bfbaa
commit f00c322689
4 changed files with 39 additions and 7 deletions

View file

@ -7,6 +7,8 @@ var autoprefixer = require('gulp-autoprefixer');
var watch = require("gulp-watch");
var cssmin = require("gulp-cssmin");
var rimraf = require("rimraf");
var mustache = require("gulp-mustache");
var rename = require("gulp-rename");
var paths = {};
paths.app = "./resources/";
@ -34,6 +36,19 @@ gulp.task("cssmin", function() {
.pipe(gulp.dest(paths.output + "css/"));
});
gulp.task("template", function() {
var ts = Math.floor(new Date());
var tmpl = mustache({
jsfile: "/js/main.js?v=" + ts,
cssfile: "/css/main.css?v=" + ts
})
return gulp.src(paths.app + "index.mustache")
.pipe(tmpl)
.pipe(rename("index.html"))
.pipe(gulp.dest(paths.output));
});
gulp.task("styles-dev", function(next) {
runseq("scss", "autoprefixer", next);
});
@ -61,10 +76,10 @@ gulp.task("copy", function() {
// Default
gulp.task("dist", function(next) {
runseq("styles-dist", "cssmin", "clean-dist", "copy", next);
runseq("styles-dist", "cssmin", "template", "clean-dist", "copy", next);
});
// Watch
gulp.task("default", ["styles-dev"], function () {
gulp.task("default", ["styles-dev", "template"], function () {
gulp.watch(paths.scss, ["styles-dev"]);
});

21
npm-shrinkwrap.json generated
View file

@ -752,6 +752,11 @@
"from": "graceful-fs@>=2.0.0 <2.1.0",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-2.0.3.tgz"
},
"gulp-rename": {
"version": "1.1.0",
"from": "gulp-rename@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.1.0.tgz"
},
"gulp-util": {
"version": "2.2.20",
"from": "gulp-util@>=2.2.0 <2.3.0",
@ -824,15 +829,20 @@
}
}
},
"gulp-mustache": {
"version": "2.2.0",
"from": "gulp-mustache@latest",
"resolved": "https://registry.npmjs.org/gulp-mustache/-/gulp-mustache-2.2.0.tgz"
},
"gulp-plumber": {
"version": "1.1.0",
"from": "gulp-plumber@1.1.0",
"resolved": "https://registry.npmjs.org/gulp-plumber/-/gulp-plumber-1.1.0.tgz"
},
"gulp-rename": {
"version": "1.1.0",
"from": "gulp-rename@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.1.0.tgz"
"version": "1.2.2",
"from": "gulp-rename@latest",
"resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-1.2.2.tgz"
},
"gulp-sass": {
"version": "2.2.0",
@ -1373,6 +1383,11 @@
"from": "multipipe@>=0.1.2 <0.2.0",
"resolved": "https://registry.npmjs.org/multipipe/-/multipipe-0.1.2.tgz"
},
"mustache": {
"version": "2.2.1",
"from": "mustache@>=2.2.1 <3.0.0",
"resolved": "https://registry.npmjs.org/mustache/-/mustache-2.2.1.tgz"
},
"nan": {
"version": "2.2.0",
"from": "nan@>=2.0.8 <3.0.0",

View file

@ -21,7 +21,9 @@
"gulp-autoprefixer": "3.1.0",
"gulp-clean": "0.3.1",
"gulp-cssmin": "0.1.7",
"gulp-mustache": "2.2.0",
"gulp-plumber": "1.1.0",
"gulp-rename": "1.2.2",
"gulp-sass": "2.2.0",
"gulp-watch": "4.3.5",
"rimraf": "2.5.2",

View file

@ -4,12 +4,12 @@
<meta charset="utf-8" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>uxbox.io - ???</title>
<link href="/css/main.css" rel="stylesheet" type="text/css" />
<link href="{{& cssfile}}" rel="stylesheet" type="text/css" />
<link rel="icon" href="/images/favicon.png" />
</head>
<body>
<section id="app" tabindex="1"></section>
<section id="lightbox" tabindex="2"></section>
<script src="/js/main.js"></script>
<script src="{{& jsfile}}"></script>
</body>
</html>