From: Joe Workman Date: Mon, 20 Jul 2020 22:29:06 +0000 (-0700) Subject: update for gulp 4 + gulp-sass 4 X-Git-Tag: v2.3.0^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c8b74f12bb14536685f317b46d7a75daa535df5f;p=thirdparty%2Ffoundation%2Ffoundation-emails.git update for gulp 4 + gulp-sass 4 --- diff --git a/.browserslistrc b/.browserslistrc new file mode 100644 index 00000000..3739808d --- /dev/null +++ b/.browserslistrc @@ -0,0 +1,5 @@ +# Browsers that we support +last 2 versions +ie >= 9 +ios >= 7 +android >= 4.4 diff --git a/gulpfile.js b/gulpfile.js index 3564ba12..71566472 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -12,6 +12,9 @@ var siphon = require('siphon-media-query'); var lazypipe = require('lazypipe'); var fs = require('fs'); var yargs = require('yargs'); +var sass = require('gulp-sass'); + +sass.compiler = require('node-sass'); // Configuration for the documentation generator supercollider @@ -72,25 +75,24 @@ gulp.task('html', function() { }); }); -gulp.task('sass', ['sass:docs', 'sass:foundation']); // Compiles documentation-specific CSS gulp.task('sass:docs', function() { return gulp.src('docs/assets/scss/docs.scss') - .pipe($.sass({ includePaths: [process.cwd()] }).on('error', $.sass.logError)) - .pipe($.autoprefixer({ - browsers: ['last 2 versions', 'ie >= 9'] - })) + .pipe(sass.sync({ includePaths: [process.cwd()] }).on('error', sass.logError)) + .pipe($.autoprefixer()) .pipe(gulp.dest('_build/assets/css')); }); // Compiles Foundation-specific CSS gulp.task('sass:foundation', function() { return gulp.src('scss/foundation-emails.scss') - .pipe($.sass().on('error', $.sass.logError)) + .pipe(sass.sync().on('error', sass.logError)) .pipe(gulp.dest('_build/assets/css')); }); +gulp.task('sass', gulp.series('sass:docs', 'sass:foundation')); + // Compiles documentation JavaScript gulp.task('javascript:docs', function() { return gulp.src(['node_modules/foundation-docs/js/*.js', 'docs/assets/js/**/*.js']) @@ -115,16 +117,18 @@ gulp.task('lint', function() { .pipe($.sassLint.failOnError()); }); +// Runs the entire build process +gulp.task('build', gulp.series('clean', 'copy', 'copy-inky', 'html', 'sass', 'javascript:docs', function(cb){ + cb(); +})); + // Creates a BrowserSync server -gulp.task('server', ['build'], function() { - browser.init({ - server: './_build', - port: yargs.argv.port || 3001 - }); -}); +gulp.task('server', gulp.series('build', function(){ + browser.init({server: './_build', port: yargs.argv.port||3001}); +})); // Uploads the documentation to the live server -gulp.task('deploy:docs', ['build'], function() { +gulp.task('deploy:docs', gulp.series('build'), function() { return gulp.src('./_build/**') .pipe($.prompt.confirm('Make sure everything looks right before you deploy.')) .pipe($.rsync({ @@ -134,23 +138,13 @@ gulp.task('deploy:docs', ['build'], function() { })); }); -// Runs the entire build process -gulp.task('build', function(cb) { - sequence('clean', ['copy', 'copy-inky', 'html', 'sass', 'javascript:docs'], cb); -}); // Runs the build process, spins up a server, and watches for file changes -gulp.task('default', ['server'], function() { +gulp.task('default', gulp.series('server', function() { gulp.watch('docs/**/*', ['html', browser.reload]); gulp.watch(['docs/assets/scss/**/*', 'node_modules/foundation-docs/scss/**/*'], ['sass:docs', browser.reload]); gulp.watch('scss/**/*.scss', ['sass:foundation', browser.reload]); -}); - -gulp.task('test', ['sass', 'test:compile'], function() { - browser.init({ server: 'test/visual/_build', directory: true }); - gulp.watch('scss/**/*.scss', ['sass:foundation', browser.reload]); - gulp.watch('test/visual/pages/*.html', ['test:compile', browser.reload]); -}); +})); gulp.task('test:compile', function() { gulp.src('test/visual/pages/*.html') @@ -160,6 +154,12 @@ gulp.task('test:compile', function() { .pipe(gulp.dest('test/visual/_build')); }); +gulp.task('test', gulp.series('sass', 'test:compile', function() { + browser.init({ server: 'test/visual/_build', directory: true }); + gulp.watch('scss/**/*.scss', ['sass:foundation', browser.reload]); + gulp.watch('test/visual/pages/*.html', ['test:compile', browser.reload]); +})); + gulp.task('templates', function() { return gulp.src('templates/*.html') .pipe($.wrap({ src: 'test/visual/_template.html' })) @@ -178,37 +178,37 @@ gulp.task('download:build:index', function() { .pipe(gulp.dest('.download')); }); -gulp.task('download:build:templates', ['templates'], function() { +gulp.task('download:build:templates', gulp.series('templates', function() { return gulp.src('.templates/*.html') .pipe(gulp.dest('.download/templates')); -}); +})); -gulp.task('download:build:css', ['sass:foundation'], function() { +gulp.task('download:build:css', gulp.series('sass:foundation', function() { return gulp.src('_build/assets/css/foundation-emails.css') .pipe(gulp.dest('.download/css')); -}) +})); -gulp.task('download:build', ['download:build:index', 'download:build:templates', 'download:build:css'], function() { +gulp.task('download:build', gulp.series('download:build:index', 'download:build:templates', 'download:build:css', function() { return gulp.src('.download/**/*') .pipe($.zip('foundation-emails.zip')) .pipe(gulp.dest('.')); -}); +})); -gulp.task('download', ['download:build'], function(done) { +gulp.task('download', gulp.series('download:build', function(done) { return gulp.src('foundation-emails.zip') .pipe($.rsync({ hostname: 'deployer@72.32.134.77', destination: '/home/deployer/sites/foundation-sites-6-marketing/downloads/' })); -}); +})); -gulp.task('dist', ['sass:foundation'], function() { +gulp.task('dist', gulp.series('sass:foundation', function() { return gulp.src('_build/assets/css/foundation-emails.css') .pipe(gulp.dest('dist')) .pipe($.cssnano()) .pipe($.rename('foundation-emails.min.css')) .pipe(gulp.dest('dist')); -}); +})); function inliner(css) { css = fs.readFileSync(css).toString(); diff --git a/package.json b/package.json index b2af6ca9..2c3ca938 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "browser-sync": "^2.9.10", "cheerio": "^1.0.0-rc.3", "clipboard-js": "^0.3.6", - "foundation-docs": "zurb/foundation-docs", + "foundation-docs": "foundation/foundation-docs", "foundation-sites": "^6.2.0", "gulp": "^4.0.2", "gulp-autoprefixer": "^7.0.1", @@ -40,15 +40,17 @@ "gulp-prompt": "^1.2.0", "gulp-rename": "^1.2.2", "gulp-rsync": "0.0.8", - "gulp-sass": "^4.0.2", - "gulp-sass-lint": "^1.1.1", + "gulp-sass": "^4.1.0", + "gulp-sass-lint": "^1.4.0", "gulp-sourcemaps": "^2.6.5", "gulp-wrap": "^0.15.0", "gulp-zip": "^5.0.1", "inky": "foundation/inky#browser-build", + "js-yaml": "^3.14.0", "lazypipe": "^1.0.1", "motion-ui": "^2.0.3", "multiline": "^2.0.0", + "node-sass": "^4.14.1", "octophant": "^1.0.0", "panini": "^1.2.0", "rimraf": "^3.0.0", @@ -57,8 +59,7 @@ "supercollider": "^1.4.0", "typeahead.js": "^0.11.1", "yargs": "^14.2.0", - "zeroclipboard": "^2.2.0", - "js-yaml": "^3.14.0" + "zeroclipboard": "^2.2.0" }, "license": "MIT", "eyeglass": { diff --git a/yarn.lock b/yarn.lock index a637799e..77fe805c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2758,9 +2758,9 @@ formidable@^1.2.2: resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.2.2.tgz#bf69aea2972982675f00865342b982986f6b8dd9" integrity sha512-V8gLm+41I/8kguQ4/o1D3RIHRmhYFG4pnNyonvua+40rqcEmT4+V71yaZ3B457xbbgCsCfjSPi65u/W6vK1U5Q== -foundation-docs@zurb/foundation-docs: +foundation-docs@foundation/foundation-docs: version "0.2.2" - resolved "https://codeload.github.com/zurb/foundation-docs/tar.gz/b951a97bb0e5ee94d74050590aa179bf15181a4b" + resolved "https://codeload.github.com/foundation/foundation-docs/tar.gz/b951a97bb0e5ee94d74050590aa179bf15181a4b" dependencies: cheerio "^1.0.0-rc.2" handlebars "^4.1.2" @@ -3330,7 +3330,7 @@ gulp-rsync@0.0.8: lodash.isstring "^2.4.1" through2 "^0.6.1" -gulp-sass-lint@^1.1.1: +gulp-sass-lint@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/gulp-sass-lint/-/gulp-sass-lint-1.4.0.tgz#6f7096c5abcbc0ce99ddf060c9e1a99067a47ebe" integrity sha512-XerYvHx7rznInkedMw5Ayif+p8EhysOVHUBvlgUa0FSl88H2cjNjaRZ3NGn5Efmp+2HxpXp4NHqMIbOSdwef3A== @@ -3339,7 +3339,7 @@ gulp-sass-lint@^1.1.1: sass-lint "^1.12.0" through2 "^2.0.2" -gulp-sass@^4.0.2: +gulp-sass@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/gulp-sass/-/gulp-sass-4.1.0.tgz#486d7443c32d42bf31a6b1573ebbdaa361de7427" integrity sha512-xIiwp9nkBLcJDpmYHbEHdoWZv+j+WtYaKD6Zil/67F3nrAaZtWYN5mDwerdo7EvcdBenSAj7Xb2hx2DqURLGdA== @@ -3449,7 +3449,7 @@ gulplog@^1.0.0: dependencies: glogg "^1.0.0" -handlebars@^4.0.5, handlebars@^4.1.2, handlebars@^4.5.3: +handlebars@^4.0.5, handlebars@^4.1.2: version "4.7.6" resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.6.tgz#d4c05c1baf90e9945f77aa68a7a219aa4a7df74e" integrity sha512-1f2BACcBfiwAfStCKZNrUCgqNZkGsAT7UM3kkYtXuLo0KnaVfjKOyf7PRzB6++aK9STyT1Pd2ZCPe3EGOXleXA== @@ -3568,7 +3568,7 @@ highlight.js@^8.9.1: resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-8.9.1.tgz#b8a9c5493212a9392f0222b649c9611497ebfb88" integrity sha1-uKnFSTISqTkvAiK2SclhFJfr+4g= -highlight.js@^9.16.2: +highlight.js@^9.0.0: version "9.18.1" resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.18.1.tgz#ed21aa001fe6252bb10a3d76d47573c6539fe13c" integrity sha512-OrVKYz70LHsnCgmbXctv/bfuvntIKDz177h0Co37DQ5jamGZLVmoCVMtjMtNZY3X9DrCcKfklHPNeA0uPZhSJg== @@ -5471,7 +5471,7 @@ node-releases@^1.1.58: resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.59.tgz#4d648330641cec704bff10f8e4fe28e453ab8e8e" integrity sha512-H3JrdUczbdiwxN5FuJPyCHnGHIFqQ0wWxo+9j1kAXAzqNMAHlo+4I/sYYxpyK0irQ73HgdiyzD32oqQDcU2Osw== -node-sass@^4.8.3: +node-sass@^4.14.1, node-sass@^4.8.3: version "4.14.1" resolved "https://registry.yarnpkg.com/node-sass/-/node-sass-4.14.1.tgz#99c87ec2efb7047ed638fb4c9db7f3a42e2217b5" integrity sha512-sjCuOlvGyCJS40R8BscF5vhVlQjNN069NtQ1gSxyK1u9iqvn6tf7O1R4GNowVZfiZUCRt5MmMs1xd+4V/7Yr0g==