Giter Site home page Giter Site logo

Comments (5)

JPeer264 avatar JPeer264 commented on June 12, 2024

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.

davewallace avatar davewallace commented on June 12, 2024

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.

JPeer264 avatar JPeer264 commented on June 12, 2024

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.

davewallace avatar davewallace commented on June 12, 2024

Yep, . generateMapping sounds like a sensible replacement :)

from node-rename-css-selectors.

JPeer264 avatar JPeer264 commented on June 12, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.