rails / cssbundling-rails

Bundle and process CSS in Rails with Tailwind, PostCSS, and Sass via Node.js.
MIT License
579 stars 83 forks source link

Use Tailwind CSS, Bootstrap, Bulma, PostCSS, or Dart Sass to bundle and process your CSS #105

Closed MtnBiker closed 1 year ago

MtnBiker commented 1 year ago

The "or" is confusing. If you install Bootstrap, you have application.bootstrap.scss. Is it processed twice?

jasonfb commented 1 year ago

rails new Xyz --css=bootstrap leads to an application with: • JS Bundling Rails • CSS Bundling Rails • A foreman (./bin/dev) file that looks like this:

web: bin/rails server -p 3000
js: yarn build --watch
css: yarn build:css --watch

• A package.json file that builds the file app/assets/stylesheets/application.bootstrap.scss into the file app/assets/builds/application.css

    "build:css": "sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules"
MtnBiker commented 1 year ago

I understand this better now. Some of the confusion is a bootstrap install installs esbuild.

Another question: Why isn't the file just named app/assets/stylesheets/application.scss to be consistent with the same content. Some people seem to have the application.scss import a file bootstrap.scss which has the two imports which separates things, but for two lines not sure it's needed.