Comments (4)
@unematiii it's now working 😄 really thank you for all the help!!!
from css-loader-short-classnames.
I did some research and apparently Gridsome CLI generated projects seem to pull in css-loader
version 2.1.1
(latest is 4.3.0
), and for this version options should be provided differently:
gridsome.config.js
:
const { getLocalIdentName } = require("css-loader-shorter-classnames");
const isProduction = process.env.NODE_ENV === "production";
module.exports = {
// ... other config options
css: {
loaderOptions: {
css: {
localIdentName: "[local]-[hash:base64:8]",
...(isProduction ? { getLocalIdent: getLocalIdentName() } : {}),
},
},
},
};
Attaching sample project with working configuration.
from css-loader-short-classnames.
Hello @unematiii!! You're amazing, really thank you for your quick reply.
I took your sample project, I added the Buefy and imported into the main.js. If you try to do gridsome build
you notice that the output is the same. There's no effect happening. 🤔
Here is the updated sample project.
Really thank you for the help!
from css-loader-short-classnames.
Hey!
Actually everything in Vue SFC-s do get correct class names. I guess <style module></style>
in *.vue
components does the trick here. (Observe the first lines of the sample projects built css file). You can enable modules for all the the other css assets by setting additionally modules: true
:
module.exports = {
// ... other config options
css: {
loaderOptions: {
css: {
modules: true,
localIdentName: "[local]-[hash:base64:8]",
...(isProduction ? { getLocalIdent: getLocalIdentName() } : {}),
},
},
},
};
But beware, enabling modules for external libraries can cause some problems: if you yourself or the JS implementation of the library rely on static class names. Then you should use different configuration for the styles in you app and for those of external libraries.
from css-loader-short-classnames.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from css-loader-short-classnames.