Skip to content

Custom parts javascript? #1101

Answered by Bramjetten
tlbrack asked this question in Q&A
Sep 12, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

This is how we do that in Spina Pro:

# engine.rb
module Spina
  module Pro
    class Engine < ::Rails::Engine
      # ...
      initializer "spina.pro.assets.assets" do |app|
        # Add pro Stimulus controllers to Spina's importmap
        Spina.config.importmap.draw do |paths|
          pin_all_from Spina::Pro::Engine.root.join("app/assets/javascripts/spina/pro/controllers"), under: "controllers", to: "spina/pro/controllers"
          pin_all_from Spina::Pro::Engine.root.join("app/assets/javascripts/spina/pro/libraries"), under: "libraries", to: "spina/pro/libraries"
        end
        
        # Add assets manifest to assets.precompile
        app.config.assets.precompile += %w(spin…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tlbrack
Comment options

Answer selected by Bramjetten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants