Simplify importing of css when using vite

trunk
Matt Brictson 2 years ago
parent 63c76860bc
commit b7fea92a23
No known key found for this signature in database
GPG Key ID: E379525AE7FB9561

@ -1 +0,0 @@
@import "~/stylesheets";

@ -8,8 +8,6 @@ copy_file "app/assets/stylesheets/mixins/typography.scss", "app/frontend/stylesh
gsub_file "app/frontend/stylesheets/index.scss", /@use "\./, '@use "~/stylesheets'
copy_file "app/frontend/entrypoints/application.scss"
package_json = File.read("package.json")
if package_json.match?(%r{@hotwired/turbo-rails})
prepend_to_file "app/frontend/entrypoints/application.js", <<~JS
@ -19,6 +17,7 @@ end
if package_json.match?(%r{@hotwired/stimulus})
prepend_to_file "app/frontend/entrypoints/application.js", <<~JS
import "~/controllers";
import "~/stylesheets/index.scss";
JS
end

@ -39,9 +39,6 @@ if install_vite?
gsub_file "app/views/layouts/base.html.erb",
/vite_javascript_tag 'application' %>/,
'vite_javascript_tag "application", "data-turbo-track": "reload" %>'
insert_into_file "app/views/layouts/base.html.erb", <<-ERB, before: /^.*<%= vite_javascript_tag/
<%= vite_stylesheet_tag "application.scss", "data-turbo-track": "reload" %>
ERB
end
copy_file "app/views/layouts/application.html.erb"

Loading…
Cancel
Save