Closed dailson-igo closed 1 year ago
You need to follow this instruction, then run yarn build:css
manually before starting the rails server. That's the cssbundling-rails way.
sassc-rails
is just unnecessary.
Hi @mshibuya, From my understanding, the rationale for importmap is to get rid of bundling assets (i.e. dropping npm / yarn...). Shouldn't css be loaded through the old sprockets way when going for importmap?
thanks
cssbundling-rails is not 'the old sprockets way', the build process is totally different.
So what's your recommendation on building CSS, not JS?
Well, I'm definitely not a master of rails asset pipeline, so this should be challenged.
Based on some research (see below), I think the goal would be to avoid adding js bundling if user is trying to go the rails 7 way.
I am not convinced our point is to obviously mimick user's gemfile choices (cftailwindcss
or dartsass
references below).
First option i have in mind: letting the user decide what he wants for js and what he wants for css.
2nd option: inspect the user's app repository and make arbitrary choices based on its config. Pseudo code
if File.dirname("#{destination_root}/node_modules").directory? && File.join(destination_root, 'packages.json')).exists?
# bundle both js & css through webacker or webpack (since node_modules in use)
elsif File.join(destination_root, 'config/importmap.rb')).exists?
# import map process for js
# use sprockets for css (through sassc-rails). (since node_modules not in use)
else
# use sprockets fo js & css
end
Research sources:
cssbundling-rails
is Node based pipelinecssbundling-rails
states that to go the importmaps way we should use tailwindcss-rails
and dartsass-rails
(which I have never used yet)What do you think @mshibuya ?
you need to install cssbundling-rails in addition to import-map:
./bin/bundle add cssbundling-rails
./bin/rails css:install:sass
Describe the bug Error: File to import not found or unreadable: rails_admin/src/rails_admin/styles/base with version 3.1 and importmap, without ESbuild. The problem does not occur when I use ESbuild with version 3.1 or without ESbuild with version 3.0.
Reproduction steps
Expected behavior I expect the version 3.1.0 work with importmap, without ESbuild.
Additional context
rails
version: 7.0.4rails_admin
version: 3.1.0rails_admin
npm package version: 8.19.2Files referencing the rails_admin text in version 3.1.0.