ctxhou / postcss-hash-classname Goto Github PK
View Code? Open in Web Editor NEWPostCSS plugin to append hash string to your css class name.
License: MIT License
PostCSS plugin to append hash string to your css class name.
License: MIT License
CSS modules has the idea of generating unique class names (like this package) and integrating with webpack and browserify. You might want to contribute there https://github.com/css-modules
.a .b .c {
...
}
=>
.a .b .c-dfdfji1 {
...
}
bug
Why output JSO files contains dot in class name?
module.exports = {
foo: ".foo-sdijhfdsifj1"
}
With this dot I can’t just use JSON in React template:
import styles from 'style.css.json';
export default function Logo() {
return <div class={ style.foo }></div>;
}
.sdfsd.sdfsdf.sdf{
...
}
Maybe we also need hashes for keyframes too. To have better isolation.
In the case when processing multiple source files in the same directory, there is no way to differentiate the output .js/.json
filename per source file.
Because of this, how ever the output .js/.json
file happens to be named, multiple files generated for multiple source files in the same directory will end up overwriting each-other.
For example, say we have 3 .css files in same directory:
ls styles/
output: styleA.css, styleB.css, styleC.css
... and then run the plugin:
gulp.src(['./styles/*.css'])
.pipe(
postcss(
[ require('postcss-hash-classname')({ outputName: 'style' }) ]
)
)
... all 3 .css files will generate output of same name (style.js
) and will end up overwriting each-other:
ls styles/
output: styleA.css, styleB.css, styleC.css., style.js
The "outputName" property, defining the output .js/.json
file's filename should offer some mechanism to dynamically set the output filename based off of the source file's filename.
bug:
.yo:before {
...
}
become
.yo:before-sdfsdsdf {
...
}
purpose: to get more unique hash
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.