aboutsummaryrefslogtreecommitdiffstats
path: root/gulpfile.js
diff options
context:
space:
mode:
authorkumavis <aaron@kumavis.me>2018-03-30 12:28:35 +0800
committerkumavis <aaron@kumavis.me>2018-03-30 12:28:35 +0800
commit4606a23c3fbfbbbd93ea59f3ca3e2e06766d3a04 (patch)
treeb86c1d750c322042bc613862575ab7c22c6856ff /gulpfile.js
parent77d4a9a2bbd28c633cb6731cdbce47d3f79972a7 (diff)
downloadtangerine-wallet-browser-4606a23c3fbfbbbd93ea59f3ca3e2e06766d3a04.tar
tangerine-wallet-browser-4606a23c3fbfbbbd93ea59f3ca3e2e06766d3a04.tar.gz
tangerine-wallet-browser-4606a23c3fbfbbbd93ea59f3ca3e2e06766d3a04.tar.bz2
tangerine-wallet-browser-4606a23c3fbfbbbd93ea59f3ca3e2e06766d3a04.tar.lz
tangerine-wallet-browser-4606a23c3fbfbbbd93ea59f3ca3e2e06766d3a04.tar.xz
tangerine-wallet-browser-4606a23c3fbfbbbd93ea59f3ca3e2e06766d3a04.tar.zst
tangerine-wallet-browser-4606a23c3fbfbbbd93ea59f3ca3e2e06766d3a04.zip
build - refactor scss compilation into single config
Diffstat (limited to 'gulpfile.js')
-rw-r--r--gulpfile.js81
1 files changed, 63 insertions, 18 deletions
diff --git a/gulpfile.js b/gulpfile.js
index 0c16eb18e..4a4ab8ee0 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -109,7 +109,7 @@ function createCopyTasks(label, opts) {
copyTask(copyTaskName, opts)
copyTaskNames.push(copyTaskName)
}
- const copyDevTaskName = `copy:dev:${label}`
+ const copyDevTaskName = `dev:copy:${label}`
copyTask(copyDevTaskName, Object.assign({ devMode: true }, opts))
copyDevTaskNames.push(copyDevTaskName)
}
@@ -168,7 +168,7 @@ gulp.task('copy',
)
)
-gulp.task('copy:dev',
+gulp.task('dev:copy',
gulp.series(
gulp.parallel(...copyDevTaskNames),
'manifest:chrome',
@@ -199,17 +199,50 @@ gulp.task('lint:fix', function () {
// scss compilation and autoprefixing tasks
-gulp.task('build:scss', function () {
- return gulp.src('ui/app/css/index.scss')
- .pipe(sourcemaps.init())
- .pipe(sass().on('error', sass.logError))
- .pipe(sourcemaps.write())
- .pipe(autoprefixer())
- .pipe(gulp.dest('ui/app/css/output'))
-})
-gulp.task('watch:scss', function() {
- gulp.watch(['ui/app/css/**/*.scss'], gulp.series(['build:scss']))
-})
+// gulp.task('build:scss', function () {
+// return gulp.src('ui/app/css/index.scss')
+// .pipe(sourcemaps.init())
+// .pipe(sass().on('error', sass.logError))
+// .pipe(sourcemaps.write())
+// .pipe(autoprefixer())
+// .pipe(gulp.dest('ui/app/css/output'))
+// })
+// gulp.task('dev:scss', function() {
+// gulp.watch(['ui/app/css/**/*.scss'], gulp.parallel(['build:scss']))
+// })
+
+
+
+gulp.task('build:scss', createScssBuildTask({
+ src: 'ui/app/css/index.scss',
+ dest: 'ui/app/css/output',
+ devMode: false,
+}))
+
+gulp.task('dev:scss', createScssBuildTask({
+ src: 'ui/app/css/index.scss',
+ dest: 'ui/app/css/output',
+ devMode: true,
+ pattern: 'ui/app/css/**/*.scss',
+}))
+
+function createScssBuildTask({ src, dest, devMode, pattern }) {
+ return function () {
+ if (devMode) {
+ watch(pattern, buildScss)
+ }
+ return buildScss()
+ }
+
+ function buildScss() {
+ return gulp.src(src)
+ .pipe(sourcemaps.init())
+ .pipe(sass().on('error', sass.logError))
+ .pipe(sourcemaps.write())
+ .pipe(autoprefixer())
+ .pipe(gulp.dest(dest))
+ }
+}
gulp.task('lint-scss', function() {
return gulp
@@ -321,15 +354,27 @@ gulp.task('apply-prod-environment', function(done) {
});
// high level tasks
+//
+// gulp.task('dev',
+// gulp.series(
+// 'build:scss',
+// 'copy',
+// gulp.parallel(
+// 'dev:js',
+// 'dev:scss',
+// 'dev:copy',
+// 'dev:reload'
+// )
+// )
+// )
gulp.task('dev',
gulp.series(
- 'build:scss',
- 'copy',
+ 'clean',
+ 'dev:scss',
gulp.parallel(
'dev:js',
- 'watch:scss',
- 'copy:dev',
+ 'dev:copy',
'dev:reload'
)
)
@@ -341,7 +386,7 @@ gulp.task('build',
'build:scss',
gulp.parallel(
'build:js:extension',
- 'build:js:mascara',
+ // 'build:js:mascara',
'copy'
)
)