Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: gulpfile.js

Issue 29624561: Issue 6104 - Minified code in help center repository (Closed) Base URL: https://hg.adblockplus.org/help.eyeo.com
Patch Set: Consolidated gulp tasks Created Dec. 7, 2017, 2:48 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « globals/get_inline_bg.py ('k') | includes/layout/header.tmpl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gulpfile.js
===================================================================
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -13,25 +13,60 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with help.eyeo.com. If not, see <http://www.gnu.org/licenses/>.
*/
const gulp = require('gulp');
const gutil = require('gulp-util');
+const sourcemaps = require('gulp-sourcemaps');
+const rename = require('gulp-rename');
const sass = require('gulp-sass');
const postcss = require('gulp-postcss');
const scss = require('postcss-scss');
const autoprefixer = require('autoprefixer');
+const minify = require('gulp-minify');
+
+/******************************************************************************
+ * CSS
+ ******************************************************************************/
gulp.task('css', function() {
juliandoucette 2017/12/08 14:57:21 Single quotes :( ... (I love single quotes... I w
ire 2017/12/11 15:29:31 Done.
- return gulp.src('./static/scss/main.scss')
- .pipe(postcss([autoprefixer()], {syntax: scss}).on('error', gutil.log))
- .pipe(sass().on('error', gutil.log))
- .pipe(gulp.dest('./static/css'));
+ return gulp.src(`./static/src/scss/main.scss`)
juliandoucette 2017/12/08 14:57:17 Backtics...
ire 2017/12/11 15:29:32 Done.
+ .pipe(sourcemaps.init())
+ .pipe(postcss([autoprefixer()], {syntax: scss}).on('error', gutil.log))
+ .pipe(sass({outputStyle: 'compressed'}).on('error', gutil.log))
+ .pipe(rename(`main.min.css`))
+ .pipe(sourcemaps.write('./'))
+ .pipe(gulp.dest('./static/dist/css'));
});
-gulp.task('watch', function() {
- gulp.watch('./static/scss/**/*.scss', ['css']);
+/******************************************************************************
+ * JS
+ ******************************************************************************/
+
+gulp.task('js', function() {
+ return gulp.src(['./static/src/js/**/*.js'])
+ .pipe(sourcemaps.init())
+ .pipe(minify({
+ noSource: true,
+ ext: {src:'.js', min:'.min.js'},
juliandoucette 2017/12/08 14:57:17 Maybe src:js is unnecessary?
ire 2017/12/11 15:29:31 Done.
+ preserveComments: 'some'
+ }))
+ .pipe(sourcemaps.write('./'))
+ .pipe(gulp.dest('./static/dist/js'))
});
-gulp.task('default', ['css', 'watch']);
+/******************************************************************************
+ * Watch
+ ******************************************************************************/
+
+gulp.task('watch', function() {
+ gulp.watch('./static/src/scss/**/*.scss', ['css']);
+ gulp.watch('./static/src/js/**/*.js', ['js']);
+});
+
+/******************************************************************************
+ * Default
+ ******************************************************************************/
+
+gulp.task('default', ['css', 'js', 'watch']);
« no previous file with comments | « globals/get_inline_bg.py ('k') | includes/layout/header.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld