This commit is contained in:
Christophe 2021-06-18 11:26:45 +02:00
parent 3a182e2586
commit e07a22c3d8
4 changed files with 1221 additions and 1933 deletions

View file

@ -3,26 +3,25 @@ const gulpSass = require('gulp-sass');
const sourcemaps = require('gulp-sourcemaps'); const sourcemaps = require('gulp-sourcemaps');
const postcss = require('gulp-postcss'); const postcss = require('gulp-postcss');
const autoprefixer = require('autoprefixer'); const autoprefixer = require('autoprefixer');
const cssnano = require('cssnano');
const notify = require('gulp-notify'); const notify = require('gulp-notify');
const concat = require('gulp-concat'); const concat = require('gulp-concat');
const uglify = require('gulp-uglify'); const uglify = require('gulp-uglify');
const babel = require('gulp-babel'); const babel = require('gulp-babel');
const rename = require('gulp-regex-rename'); const rename = require('gulp-regex-rename');
const unuse = require('postcss-uncss'); //https://github.com/uncss/postcss-uncss // const unuse = require('postcss-uncss'); //https://github.com/uncss/postcss-uncss
/* /*
* SASS$ * SASS$
*/ */
function sass() { function sass() {
let options_unuse = { let options_unuse = {
html: 'http://starter.spip' html: 'http://starter.spip',
}; };
return ( return (
src('css/**/*.scss') src('css/**/*.scss')
.pipe(sourcemaps.init()) .pipe(sourcemaps.init())
.pipe(gulpSass({ outputStyle: 'expanded' })) .pipe(gulpSass({ outputStyle: 'expanded' }))
.on('error', err => notify().write(err)) .on('error', (err) => notify().write(err))
.pipe(postcss([autoprefixer()])) // autoprefixer .pipe(postcss([autoprefixer()])) // autoprefixer
//.pipe(postcss([autoprefixer(), cssnano()])) // autoprefixer + minifier //.pipe(postcss([autoprefixer(), cssnano()])) // autoprefixer + minifier
//.pipe(postcss([unuse(options_unuse), autoprefixer()])) // css unuse + autoprefixer //.pipe(postcss([unuse(options_unuse), autoprefixer()])) // css unuse + autoprefixer
@ -39,7 +38,7 @@ function jsConcatMinif() {
.pipe(sourcemaps.init()) .pipe(sourcemaps.init())
.pipe( .pipe(
babel({ babel({
presets: ['@babel/preset-env'] presets: ['@babel/preset-env'],
}) })
) )
.pipe(concat('mon_site.min.js', { newLine: ';' })) .pipe(concat('mon_site.min.js', { newLine: ';' }))
@ -55,7 +54,7 @@ function jsBabel() {
return src(['js/*.es6.js']) return src(['js/*.es6.js'])
.pipe( .pipe(
babel({ babel({
presets: ['@babel/preset-env'] presets: ['@babel/preset-env'],
}) })
) )
.pipe(rename(/\.es6/, '')) .pipe(rename(/\.es6/, ''))
@ -66,19 +65,19 @@ function jsBabel() {
* Les Watchers * Les Watchers
*/ */
function watcherSass() { function watcherSass() {
watch('css/**/*.scss', { ignoreInitial: false }, sass).on('change', function() { watch('css/**/*.scss', { ignoreInitial: false }, sass).on('change', function () {
notify('CSS -> SCSS ==> OK').write(''); notify('CSS -> SCSS ==> OK').write('');
}); });
} }
function watcherJsConcatMinif() { function watcherJsConcatMinif() {
watch('./js/a_compresser/*.js', { ignoreInitial: false }, jsConcatMinif).on('change', function() { watch('./js/a_compresser/*.js', { ignoreInitial: false }, jsConcatMinif).on('change', function () {
notify('JS (concat) ==> OK').write(''); notify('JS (concat) ==> OK').write('');
}); });
} }
function watcherJsBabel() { function watcherJsBabel() {
watch('./js/*.es6.js', { ignoreInitial: false }, jsBabel).on('change', function() { watch('./js/*.es6.js', { ignoreInitial: false }, jsBabel).on('change', function () {
notify('JS (babel) ==> OK').write(''); notify('JS (babel) ==> OK').write('');
}); });
} }
@ -90,8 +89,8 @@ const gulpSvgSprite = require('gulp-svg-sprite');
const config = { const config = {
shape: { shape: {
spacing: { spacing: {
box: 'icon' box: 'icon',
} },
}, },
mode: { mode: {
//"view": { //"view": {
@ -102,9 +101,9 @@ const config = {
symbol: { symbol: {
dest: '.', dest: '.',
sprite: 'sprite_symbol_pictos.svg' sprite: 'sprite_symbol_pictos.svg',
} },
} },
}; };
function svgSprite() { function svgSprite() {
@ -112,7 +111,7 @@ function svgSprite() {
src('svg/**/*.svg') src('svg/**/*.svg')
//.pipe(plumber()) //.pipe(plumber())
.pipe(gulpSvgSprite(config)) .pipe(gulpSvgSprite(config))
.on('error', function(error) { .on('error', function (error) {
console.log(error); console.log(error);
}) })
.pipe(dest('img')) .pipe(dest('img'))
@ -124,9 +123,7 @@ function svgSprite() {
*/ */
var svgmin = require('gulp-svgmin'); var svgmin = require('gulp-svgmin');
function svgMin() { function svgMin() {
return src('svg/*.svg') return src('svg/*.svg').pipe(svgmin()).pipe(dest('./svgmin'));
.pipe(svgmin())
.pipe(dest('./svgmin'));
} }
/* /*
@ -137,5 +134,5 @@ module.exports = {
sass: sass, sass: sass,
watch: parallel(watcherSass, watcherJsConcatMinif, watcherJsBabel), watch: parallel(watcherSass, watcherJsConcatMinif, watcherJsBabel),
sprite: svgSprite, sprite: svgSprite,
svgmin: svgMin svgmin: svgMin,
}; };

View file

@ -4,7 +4,7 @@ function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableTo
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
@ -16,7 +16,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }

3081
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -18,26 +18,24 @@
"author": "tofulm at Gamuza", "author": "tofulm at Gamuza",
"license": "ISC", "license": "ISC",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.10.2", "@babel/core": "^7.14.6",
"@babel/preset-env": "^7.10.2", "@babel/preset-env": "^7.14.5",
"@types/jquery": "^3.3.38", "@types/jquery": "^3.5.5",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-babel": "^8.0.0", "gulp-babel": "^8.0.0",
"gulp-concat": "^2.6.1", "gulp-concat": "^2.6.1",
"gulp-notify": "^3.2.0", "gulp-notify": "^4.0.0",
"gulp-regex-rename": "^0.1.0", "gulp-regex-rename": "^0.1.0",
"gulp-svg-sprite": "^1.5.0", "gulp-svg-sprite": "^1.5.0",
"gulp-svgmin": "^2.2.0", "gulp-svgmin": "^3.0.0",
"gulp-uglify": "^3.0.2" "gulp-uglify": "^3.0.2"
}, },
"dependencies": { "dependencies": {
"autoprefixer": "^9.8.0", "autoprefixer": "^10.2.6",
"cssnano": "^4.1.10", "gulp-postcss": "^9.0.0",
"gulp-postcss": "^8.0.0",
"gulp-sass": "^4.1.0", "gulp-sass": "^4.1.0",
"gulp-sourcemaps": "^2.6.5", "gulp-sourcemaps": "^3.0.0",
"postcss": "^7.0.36", "postcss": "^8.3.5",
"postcss-uncss": "^0.17.0", "postcss-uncss": "^0.17.0"
"uncss": "^0.17.3"
} }
} }