luangjokaj / wordpressify

🎈 Automate your WordPress development workflow.
http://www.wordpressify.co
MIT License
1.6k stars 142 forks source link

Problems with import gulp-sass #119

Closed AndreVictor closed 2 years ago

AndreVictor commented 3 years ago

I`m tring to import the gulp-sass and I'm getting an error witch say that 'gulp-sass 5 does not have a default Sass compiler'. I was using require in lasted versions for sass compile, like that:

const sass = require('gulp-sass')(require('sass'));

However, looks like that wordpressify is now using 'import' insted of 'require'. How can I fix this?

ps.: In the documentation say to use gulp-sass with require

jumxxxx commented 3 years ago

some probleme

ribaricplusplus commented 3 years ago

@luangjokaj Yeah I've experimented quite a few times with using ES Modules with node. And even though they recommend that now, I only run into problems with it.

In my opinion, we should go back to CommonJS until Node handles ESM better. Or the ecosystem catches up with ESM. I don't think it's worth the effort right now.

h08831n commented 2 years ago

you must use this code to solve @ribaricplusplus @jumxxxx @AndreVictor

import dartSass from 'sass';
import gulpSass from 'gulp-sass';
const sass = gulpSass(dartSass);
luangjokaj commented 2 years ago

you must use this code to solve @ribaricplusplus @jumxxxx @AndreVictor

import dartSass from 'sass';
import gulpSass from 'gulp-sass';
const sass = gulpSass(dartSass);

Thank you, just tested and works. Updated also the docs: https://www.wordpressify.co/docs/css-postcss-and-sass