Comments (5)
Ah, you mean this mapping function. Yes actually it could be in every repo - this feature would be good for all of 'em. The library file was actually introduced to debug selectors if they already got minified for production.
Great idea! I originally had this idea too, but totally forgot this feature.
What do you think about putting those things into the config file .rcsrc
? This could look like following (which was the original idea)
{
"exclude": [
"some-excluded-selectors"
],
"mapping": {
"btn-group": "btn-collection"
}
}
Maybe mapping
is a bad word for it. I also don't think that it would be a good idea to put prefixes or suffixes into this, as it would be hard to debug if the prefix will be changed. As you already saw I did not put btn
into the mapping
, because it will be the same just with a prefix, so there is no need to put it into it (would be less in the config file).
from node-rename-css-selectors.
An addition in .rcsrc
would be a good idea - do you mean that keys/values present in .rcsrc
in the form of mapping
(or alternative name, perhaps override
) or exclude
would take precedence over anything generated by an unmodified output from .generateLibraryFile()
?
If the addition to .rcsrc
is not an exceptions/overrides based approach, then I imagine the mapping could potentially grow quite large if it was intended to contain the entire contents of a given set of selector replacements, for example with the mass of Bootstrap selectors I've been testing with.
from node-rename-css-selectors.
would take precedence over anything generated by an unmodified output from .generateLibraryFile()
Yes, I would say so. But, override
(that is a good name) would be, as you said, to large.
If the addition to .rcsrc is not an exceptions/overrides based approach, then I imagine the mapping could potentially grow quite large
Oh, true! I think I would drop the idea then to put the override
into the .rcsrc
. So after a bit thinking it might be a good idea to load an already generated library/mapping file with the function .generateLibraryFile( 'path/to/file' )
to ensure to load already renamed selectors and add new triggered selectors.
You think it might be a good idea to rename the method .generateLibraryFile()
to .generateMapping
or something like that?
from node-rename-css-selectors.
Yep, . generateMapping
sounds like a sensible replacement :)
from node-rename-css-selectors.
@davewallace I thought a lot about this function and came up with a slightly different solution. First you have to load the old mappings via .loadMapping
and after everything is processed you can save the new generated file with .generateMapping
.
Have a look at the usage
I hope it fits to your use case 🙃
from node-rename-css-selectors.
Related Issues (20)
- 3.2.4 breaks calc with css variables HOT 2
- Messes up with the `~` character HOT 4
- Uncaught TypeError: (0 , r.default)(...).at is not a function HOT 4
- Ignore specific class HOT 1
- renaming html tags such as div HOT 3
- [BUG] It renames EJS HOT 7
- Add documentation for rcsCore usage in rename-css-selectors
- mismatched layout after running rcs HOT 3
- Integration with Gulp HOT 16
- Ids and classes are treated as the same identity HOT 10
- Not completely renamed if there's a line break between class names HOT 6
- Exclude classes with special characters HOT 6
- [Q] Webpack Usage? HOT 6
- Does this plugin optimize the library so most frequent classes get one letter not two? HOT 2
- Minify as a function HOT 2
- Bug: Textarea and other common words replaced HOT 3
- Unused css selectors given a one letter selector - is sorting by frequency working correctly? HOT 4
- getElementById string being replaced by class selector name instead of id
- Unchanging custom class name HOT 1
- Is it possible to use rcs-core with vite/rollup)?
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 node-rename-css-selectors.