Closed kKen94 closed 4 years ago
postcss-scss
syntax doesn't actually run scss inside postcss, it only means that postcss accepts the scss syntax so scss can run after postcss.
In your case, you probably want to run scss before postcss and keep using the default css syntax inside postcss.
postcss-scss
syntax doesn't actually run scss inside postcss, it only means that postcss accepts the scss syntax so scss can run after postcss. In your case, you probably want to run scss before postcss and keep using the default css syntax inside postcss.
So what (and how) I should edit it? 🤔
Use the sass-loader
in front of the postcss-loader
.
{
test: /\.scss$/,
use: [
// ...
{
loader: 'postcss-loader',
options: {
ident: 'postcss',
plugins: () => [
// ...
],
},
},
{
loader: 'sass-loader',
options: {
// ...
},
},
],
}
Seriously, I love you man <3 Maybe this thing should be insert into documentation, as a tip or a tiny suggestion under Sass example.
Seriously, I love you man <3 Maybe this thing should be insert into documentation, as a tip or a tiny suggestion under Sass example.
I am also facing the same issue can you please share you config. It will be great helpful for me. Thanks in Advance
@avinashvalluru
const purgecss = require('@fullhuman/postcss-purgecss')({
// Specify the paths to all of the template files in your project
content: [
'./src/**/*.{ts,js,html}',
],
// This is the function used to extract class names from your templates
defaultExtractor: content => {
// Capture as liberally as possible, including things like `h-(screen-1.5)`
const broadMatches = content.match(/[^<>"'`\s]*[^<>"'`\s:]/g) || []
// Capture classes within other delimiters like .block(class="w-1/2") in Pug
const innerMatches = content.match(/[^<>"'`\s.()]*[^<>"'`\s.():]/g) || []
return broadMatches.concat(innerMatches)
}
});
module.exports = {
module: {
rules: [
{
test: /\.scss$/,
loader: 'postcss-loader',
options: {
postcssOptions: {
ident: 'postcss',
syntax: 'postcss-scss',
plugins: [
require('postcss-import'),
require('tailwindcss'),
require('postcss-nested'),
require('postcss-custom-properties'),
require('autoprefixer'),
...(process.env.NODE_ENV.trim() === "prod" || process.env.NODE_ENV.trim() === "staging") ? [purgecss] : [],
],
},
},
},
{
test: /\.scss$/i,
use: ['sass-loader'],
},
],
},
};
/*! @import */
@tailwind base;
@tailwind components;
@tailwind utilities;
(Settings for Angular)
Hi everybody and thanks for your attention.
I cannot use @each statement. I got this compilation error:
This is my webpack postcss configuration:
and this is my style.scss:
I (think) followed every single step and every suggestion to install tailwind with sass (SCSS) preprocessor since I use Angular. And the strange thing is that !important, despite documentation, works normally, but variables interpolation in @apply directive doesn't. Where I wrong?
PS: class name is created fine (.btn-green, .btn-gray, ecc...)
I follow examples in #614 without success