Skip to content

Instantly share code, notes, and snippets.

@epoz
Last active April 4, 2023 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save epoz/431282e8dd0f082be01bdfb08832bd65 to your computer and use it in GitHub Desktop.
Save epoz/431282e8dd0f082be01bdfb08832bd65 to your computer and use it in GitHub Desktop.
Compiling a directory of scss files, from TYPO3

Compiling SCSS files

From the files stored in the portal repo at https://gitlab.rlp.net/adwmainz/nfdi4culture/portal/culture_portal/-/tree/main/Resources/Private/Assets/Sass I would like to compile a seprate bundled .css file so that I can include it in the NFDI4Culture KG for some sample queries and documentation.

The index.js file is placed in ./src/index.js And all the scss files are places in ./src/scss

In the sample file js file I am only including the header.scss file for now as a test, to get things working.

Error messages

When trying to build this, I get error messages like:

SassError: Invalid CSS after "...(max-width: map": expected expression (e.g. 1px, bold), was ".get(b.$grid-breakp"
        on line 14 of src/scss/header.scss
>>         @media (max-width: map.get(b.$grid-breakpoints, 'lg') - 1) {
import "./scss/header.scss";
{
"scripts": {
"build": "webpack"
},
"dependencies": {
"bootstrap": "^5.2.3",
"node-sass": "^6.0.1",
"postcss-loader": "^7.2.4"
},
"devDependencies": {
"css-loader": "^6.7.3",
"mini-css-extract-plugin": "^2.7.5",
"sass-loader": "^13.2.2",
"webpack": "^5.77.0",
"webpack-cli": "^5.0.1"
}
}
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
entry: "./src/index.js",
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist"),
},
module: {
rules: [
{
test: /\.s[ac]ss$/i,
use: [
MiniCssExtractPlugin.loader,
"css-loader",
"sass-loader",
"postcss-loader",
],
},
],
},
plugins: [
new MiniCssExtractPlugin({
filename: "bundle.css",
}),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment