Giter Site home page Giter Site logo

Multiple importmaps about importmap-rails HOT 6 OPEN

manuelmeurer avatar manuelmeurer commented on August 15, 2024 8
Multiple importmaps

from importmap-rails.

Comments (6)

deanpcmad avatar deanpcmad commented on August 15, 2024 3

I'd also like to see this. Would be very useful for splitting up public/admin JS

from importmap-rails.

aseroff avatar aseroff commented on August 15, 2024 3

I +1 the need for this.
An approach I was considering taking is keeping a single importmap (since having unnecessary pins doesn't make a significant difference), but changing the pin's preload based on the provided import module tag.

To illustrate: javascript_importmap_tags expands to the importmap, the preloads, and the initial module import defined by the provided entry_point parameter. If we passed the entry_point parameter to javascript_importmap_module_preload_tags, we could enable the preloading to be defined by something like pin 'admin', preload: [:admin] in config/importmap.rb. The result would accomplish the desired result without having to maintain multiple importmaps.

If this seems agreeable I could throw a PR together.

from importmap-rails.

manuelmeurer avatar manuelmeurer commented on August 15, 2024

@deanpcmad Feel free to use my fork/branch as described in the PR for now: #241
I use it in production and it works great!

from importmap-rails.

sarmad90 avatar sarmad90 commented on August 15, 2024

@manuelmeurer that's great. Let me know if you need any help in completing the PR. I would be happy to help.

from importmap-rails.

sarmad90 avatar sarmad90 commented on August 15, 2024

@manuelmeurer I have added some comments on the PR.

from importmap-rails.

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.