Skip to content
This repository was archived by the owner on Dec 5, 2020. It is now read-only.

Commit a6c9cbc

Browse files
committed
fix: silent failures when using autoprefixer (#274)
When deploying a theme using this config in the package.json: "liferayTheme": { "baseTheme": "styled", "distName": "fjord-theme", "rubySass": false, "version": "7.1", "postcss": [ "autoprefixer" ] }, the deploy would silently fail because "gulp-plumber" would swallow the error. If I am reading this background material on plumber correctly: - https://github.com/floatdrop/gulp-plumber - gulpjs/gulp#91 - https://gist.github.com/floatdrop/8269868 the intent of the plug-in is to monkey patch the Gulp pipe objects such that an error in one file won't prevent the others from being processed. We added it in this repo in commit 9200922 (Jan 2016, "Use gulp-plumber for r2 task so that sass-parse errors don't abort build process"). In practice, its black magic is causing deploys to fail inscrutably, so we're dropping it. In the event of an error, let's fail fast instead. And note, in this concrete instance, I don't think there was even an error being thrown in the autoprefixer build at all (based on my `console.log()`-ing around to see at what point it was going off the rails; the postcss run is finishing just fine. Note that we could also switch our old v0.6.6 version of this dependency to the latest, v1.2.1, but there's nothing in the diff that stands out as being likely to fix this issue, and I'll be much happier if we can jettison this complexity: floatdrop/gulp-plumber@v0.6.6...v1.2.1 Test plan: In portal, in modules/apps/frontend-theme-fjord/frontend-theme-fjord, turn on autoprefixer with the config mentioned above. Run both `gradlew clean deploy` and also (the equivalent): ``` yarn run gulp deploy \ --css-common-path ./build_gradle/frontend-css-common \ --styled-path ../../frontend-theme/frontend-theme-styled/src/main/resources/META-INF/resources/_styled \ --unstyled-path ../../frontend-theme/frontend-theme-unstyled/src/main/resources/META-INF/resources/_unstyled ``` and see the build output continue past the "autoprefixer" lines to finish with: ``` [13:21:39] Finished 'deploy' after 5.27 s ✨ Done in 5.97s. ``` Likewise, see the deployment reflected in the server log: ``` 1 theme for fjord-theme is available for use ``` Closes: #274
1 parent e840025 commit a6c9cbc

File tree

4 files changed

+2
-13
lines changed

4 files changed

+2
-13
lines changed

packages/liferay-theme-tasks/package.json

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"gulp-liferay-r2-css": "^0.0.2",
2121
"gulp-livereload": "^4.0.1",
2222
"gulp-load-plugins": "^1.5.0",
23-
"gulp-plumber": "^0.6.6",
2423
"gulp-postcss": "^8.0.0",
2524
"gulp-rename": "^1.2.0",
2625
"gulp-replace-task": "^0.11.0",

packages/liferay-theme-tasks/tasks/build.js

-1
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ module.exports = function(options) {
252252
suffix: '_rtl',
253253
})
254254
)
255-
.pipe(plugins.plumber())
256255
.pipe(r2())
257256
.pipe(gulp.dest(pathBuild + '/css'));
258257
});

packages/liferay-theme-tasks/tasks/build/compile-css.js

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ module.exports = function(options) {
6868
const srcPath = path.join(cssBuild, '!(_)*.scss');
6969

7070
gulp.src(srcPath)
71-
.pipe(plugins.plumber())
7271
.pipe(gulpIf(sassOptions.sourceMap, gulpSourceMaps.init()))
7372
.pipe(gulpSass(sassOptions))
7473
.pipe(

yarn.lock

+2-10
Original file line numberDiff line numberDiff line change
@@ -3150,14 +3150,6 @@ gulp-mocha@^2.2.0:
31503150
temp "^0.8.3"
31513151
through "^2.3.4"
31523152

3153-
gulp-plumber@^0.6.6:
3154-
version "0.6.6"
3155-
resolved "https://registry.yarnpkg.com/gulp-plumber/-/gulp-plumber-0.6.6.tgz#9f9846a513c70d03216ce7a2a8ce6fd5a3fc3175"
3156-
integrity sha1-n5hGpRPHDQMhbOeiqM5v1aP8MXU=
3157-
dependencies:
3158-
gulp-util "~3"
3159-
through2 "~0.6"
3160-
31613153
gulp-postcss@^8.0.0:
31623154
version "8.0.0"
31633155
resolved "https://registry.yarnpkg.com/gulp-postcss/-/gulp-postcss-8.0.0.tgz#8d3772cd4d27bca55ec8cb4c8e576e3bde4dc550"
@@ -3229,7 +3221,7 @@ gulp-util@^2.2.20:
32293221
through2 "^0.5.0"
32303222
vinyl "^0.2.1"
32313223

3232-
gulp-util@^3.0, gulp-util@^3.0.0, gulp-util@^3.0.1, gulp-util@^3.0.4, gulp-util@^3.0.7, gulp-util@~3:
3224+
gulp-util@^3.0, gulp-util@^3.0.0, gulp-util@^3.0.1, gulp-util@^3.0.4, gulp-util@^3.0.7:
32333225
version "3.0.8"
32343226
resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f"
32353227
integrity sha1-AFTh50RQLifATBh8PsxQXdVLu08=
@@ -7720,7 +7712,7 @@ through2@^0.5.0:
77207712
readable-stream "~1.0.17"
77217713
xtend "~3.0.0"
77227714

7723-
through2@^0.6.1, through2@^0.6.3, through2@~0.6:
7715+
through2@^0.6.1, through2@^0.6.3:
77247716
version "0.6.5"
77257717
resolved "https://registry.yarnpkg.com/through2/-/through2-0.6.5.tgz#41ab9c67b29d57209071410e1d7a7a968cd3ad48"
77267718
integrity sha1-QaucZ7KdVyCQcUEOHXp6lozTrUg=

0 commit comments

Comments
 (0)