diff --git a/gulpfile.js b/gulpfile.js index d220441..7a8b92e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -7,10 +7,6 @@ const postcss = require("gulp-postcss"); const zip = require("gulp-zip"); const terser = require("gulp-terser-js"); -// postcss plugins -const atImport = require("postcss-import"); -const tailwindcss = require("tailwindcss"); - function serve(done) { livereload.listen(); done(); @@ -26,12 +22,10 @@ function hbs(done) { } function css(done) { - var processors = [atImport, tailwindcss]; - pump( [ src("assets/css/*.css", { sourcemaps: true }), - postcss(processors), + postcss(), dest("assets/built/", { sourcemaps: "." }), livereload(), ], @@ -74,10 +68,11 @@ function zipper(done) { ); } -const cssWatcher = () => watch("assets/css/**", css); -const jsWatcher = () => watch("assets/js/**", series(js, css)); +const cssWatcher = () => + watch(["postcss.config.js", "tailwind.config.js", "assets/css/**"], css); +const jsWatcher = () => watch(["assets/js/**"], series(js, css)); const hbsWatcher = () => - watch(["*.hbs", "**/**/*.hbs", "!node_modules/**/*.hbs"], series(hbs, css)); + watch(["*.hbs", "**/*.hbs", "!node_modules/**/*.hbs"], series(hbs, css)); const watcher = parallel(cssWatcher, jsWatcher, hbsWatcher); const build = series(css, js); const dev = series(build, serve, watcher); diff --git a/package.json b/package.json index 5726f40..0fe24db 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "license": "MIT", "scripts": { "dev": "gulp", - "zip": "gulp zip", + "zip": "NODE_ENV=production gulp zip", "test": "gscan .", "test:ci": "gscan --fatal --verbose .", "prepare": "husky install" @@ -53,7 +53,6 @@ "gulp-livereload": "4.0.2", "gulp-postcss": "9.0.1", "gulp-terser-js": "^5.2.2", - "gulp-uglify": "3.0.2", "gulp-zip": "5.1.0", "postcss": "^8.3.5", "postcss-import": "^14.0.2", diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..b3d0f9e --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,8 @@ +module.exports = { + plugins: [ + require("postcss-import"), + require("tailwindcss"), + require("autoprefixer"), + require("cssnano"), + ], +};