//= require stylesheet with webpacker

26 views
Skip to first unread message

fugee ohu

unread,
Jan 18, 2020, 1:59:47 AM1/18/20
to Ruby on Rails: Talk
I have my stylesheet in app/javascript/stylesheets and need to include actiontext.scss in application.scss where both files are located in app/javascript/stylesheets but using
//= require actiontext has no effect, styling is still not being applied

Ariel Juodziukynas

unread,
Jan 18, 2020, 11:11:11 AM1/18/20
to rubyonra...@googlegroups.com
"//= require ..." is Sprocket's syntax (most known as rails' assets pipeline), not webpacker's. If you really want to handle CSS assets with webpacker you should start by reading this https://github.com/rails/webpacker/blob/master/docs/css.md

El sáb., 18 ene. 2020 a las 4:00, fugee ohu (<fuge...@gmail.com>) escribió:
I have my stylesheet in app/javascript/stylesheets and need to include actiontext.scss in application.scss where both files are located in app/javascript/stylesheets but using
//= require actiontext has no effect, styling is still not being applied

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/58c1a214-6a7c-4b16-8e02-60a17cbb15d9%40googlegroups.com.

fugee ohu

unread,
Jan 18, 2020, 10:23:56 PM1/18/20
to Ruby on Rails: Talk


On Saturday, January 18, 2020 at 11:11:11 AM UTC-5, Ariel Juodziukynas wrote:
"//= require ..." is Sprocket's syntax (most known as rails' assets pipeline), not webpacker's. If you really want to handle CSS assets with webpacker you should start by reading this https://github.com/rails/webpacker/blob/master/docs/css.md

El sáb., 18 ene. 2020 a las 4:00, fugee ohu (<fuge...@gmail.com>) escribió:
I have my stylesheet in app/javascript/stylesheets and need to include actiontext.scss in application.scss where both files are located in app/javascript/stylesheets but using
//= require actiontext has no effect, styling is still not being applied

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonra...@googlegroups.com.

Nothing in there about loaders I'm trying to get actiontext.scss to load I have listed in app/javascripts/packs/application.js
import "../stylesheets/actiontext.scss"
but the styling's  not being applied

Momeas Interactive

unread,
Feb 18, 2020, 12:53:44 PM2/18/20
to Ruby on Rails: Talk
Fugee-


when you switch from css to scss, you need to rename application.css to application.scss and do the following:

stop using //= require

instead use @import always and from now on when using scss. Do not use //= require syntax anymore

this is explained in the "IMPORTANT NOTE" at the top of the sass-rails docs:



if you are trying to install Bootstrap, there are some bad tutorials on the internet. I think one of them tells you to put the bootstrap.scss into your application.js file. Don't do that.

instead backtrack on what you did and use webpack to install Bootstrap (this is NOT the same as the 'old way' which you could still do on a Rails 6 app), simple instructions here : https://gorails.com/forum/install-bootstrap-with-webpack-with-rails-6-beta

-jason
Reply all
Reply to author
Forward
0 new messages