I’m working on an older project that uses the Aurelia bundler. The project was not originally built with PostCSS, but now I’d like to add it in so I can use the postcss-preset-env plugin to automagically create CSS polyfills. Strangely everything runs exactly as before and postcss plugins don’t seem to do anything… not even throw errors. What have I missed?
Edit: read the docs a little better so now I’m getting debug output. Looks like it’s trying to do its work but now I’m getting other build errors—possibly unrelated.
//process-css.js
import {build} from 'aurelia-cli';
import gulp from 'gulp';
import project from '../aurelia.json';
import plumber from 'gulp-plumber';
import notify from 'gulp-notify';
import less from 'gulp-less';
import postcss from 'gulp-postcss';
import presetEnv from 'postcss-preset-env';
export default function processCSS() {
return gulp.src(project.cssProcessor.source, {sourcemaps: true})
.pipe(plumber({ errorHandler: notify.onError('Error: <%= error.message %>') }))
.pipe(less())
.pipe(postcss([presetEnv({
debug:true,
})]))
.pipe(build.bundle());
}
//package.json
...
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-decorators": "^7.8.3",
"@babel/preset-env": "^7.8.4",
"@babel/register": "^7.8.3",
"aurelia-cli": "^3.0.1",
"aurelia-testing": "^1.0.0",
"babel-eslint": "^10.1.0",
"browser-sync": "^2.26.7",
"connect-history-api-fallback": "^1.6.0",
"debounce": "^1.2.0",
"gulp": "^4.0.0",
"gulp-babel": "^8.0.0",
"gulp-cache": "^1.1.3",
"gulp-eslint": "^6.0.0",
"gulp-less": "^4.0.1",
"gulp-notify": "^3.2.0",
"gulp-plumber": "^1.2.1",
"gulp-postcss": "^9.0.1",
"gulp-rename": "^2.0.0",
"gulp-watch": "^5.0.1",
"minimatch": "^3.0.4",
"postcss": "^8.4.19",
"postcss-preset-env": "^7.8.3",
"promise-polyfill": "^8.1.3",
"regenerator-runtime": "^0.13.3",
"requirejs": "^2.3.6",
"text": "requirejs/text#latest",
"through2": "^3.0.1",
"vinyl-fs": "^3.0.3"
},
"browserslist" : [
"last 2 versions",
"not dead",
"iOS 12"
],
...