Last active
January 4, 2017 21:52
-
-
Save Xhamps/bb74d7308954839a9148ea3728196f83 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var path = require("path"); | |
var gulp = require("gulp"); | |
var config = require("../project.config"); | |
var runSequence = require('run-sequence'); | |
gulp.task("default", false, () => { | |
gulp.tasks.help.fn(); | |
}); | |
gulp.task("build", "Copy assets, build CSS and JS.", ["clean"], (cb) => { | |
runSequence( | |
['build:html', 'build:css', 'copy'], | |
'rev:create', | |
'rev:replace', | |
cb | |
); | |
}); | |
gulp.task("build-dev", "Build, but with unminified JS + sourcemaps.", ["clean"], () => { | |
gulp.run("build:html"); | |
gulp.run("copy"); | |
gulp.run("build:css"); | |
gulp.run("build:js-dev"); | |
} | |
); | |
gulp.task("watch", "Perform build-dev when sources change.", ["build-dev"], () => { | |
gulp.watch(path.join(config.srcFullPath, "**/*"), ["build-dev"]); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var path = require('path'); | |
var gulp = require('gulp'); | |
var rev = require('gulp-rev'); | |
var revReplace = require('gulp-rev-replace'); | |
var revDeleteOriginal = require('gulp-rev-delete-original'); | |
var config = require('../../project.config'); | |
gulp.task('rev:create', [], () => { | |
return Promise.all([ | |
new Promise((resolve, reject) => { | |
gulp.src(path.join(config.destPathProperties, '**', '*.css')) | |
.pipe(rev()) | |
.pipe(revDeleteOriginal()) | |
.on('error', reject) | |
.pipe(gulp.dest(config.destPathProperties)) | |
.pipe(rev.manifest()) | |
.pipe(gulp.dest(config.destPathProperties)) | |
.on('end', resolve); | |
}), | |
new Promise((resolve, reject) => { | |
gulp.src(path.join(config.destPathLaunch, '**', '*.css')) | |
.pipe(rev()) | |
.pipe(revDeleteOriginal()) | |
.on('error', reject) | |
.pipe(gulp.dest(config.destPathLaunch)) | |
.pipe(rev.manifest()) | |
.pipe(gulp.dest(config.destPathLaunch)) | |
.on('end', resolve); | |
}) | |
]); | |
}); | |
gulp.task('rev:replace', [], () => { | |
gulp.src(path.join(config.destPathProperties, '**', '*.html')) | |
.pipe(revReplace({ | |
manifest: gulp.src(path.join(config.destPathProperties,'rev-manifest.json')) | |
})) | |
.pipe(gulp.dest(config.destPathProperties)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tenta assim: