I am trying to upgrade a Rails 5 app that used PureCSS for stylesheets to Rails 6 with Webpacker and nothing I do can make this work other than a brute force approach.
I have these lines in application.html.erb
<%= stylesheet_pack_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
I have had to download all of the PureCSS and place the files in app/assets/stylesheets
I have then had to list each file as an import in application.js
as shown
import "../../assets/stylesheets/base.css"
import "../../assets/stylesheets/buttons.css"
import "../../assets/stylesheets/buttons-core.css"
import "../../assets/stylesheets/forms.css"
import "../../assets/stylesheets/forms-r.css"`
import "../../assets/stylesheets/menus-core.css"
import "../../assets/stylesheets/menus-dropdown.css"
import "../../assets/stylesheets/menus-horizontal.css"
import "../../assets/stylesheets/menus-scrollable.css"
import "../../assets/stylesheets/menus-skin.css"
import "../../assets/stylesheets/tables.css"
I tried to tidy this up by moving the imports into app/assets/stylesheets/application.css
...
*= require_tree .
*= require_self
*/
@import "base.css";
@import "buttons.css";
@import "buttons-core.css";
...
but this doesnt work whether I try to require or import application.css
into application.js
as either
import "../../assets/stylesheets/application.css"
or
require("../../assets/stylesheets/application.css")
Really I would have liked the purecss-sass
gem to just carry on working and I dont really understand why it doesnt?
Surely there has to be a better way?
question from:https://stackoverflow.com/questions/65884830/how-to-get-rails-6-working-with-purecss-and-webpacker