scss/sass for specific controller

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

scss/sass for specific controller

fugee ohu
if i put my styling in application.scss it works but placing it in posts.scss has no effect on app/views/posts/index.html.erb

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1560ea4b-4a80-4552-9379-f5349c2c08e2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: scss/sass for specific controller

Walter Lee Davis
Read more about how the Asset Pipeline works here: http://guides.rubyonrails.org//asset_pipeline.html

TL;DR: If you add an import statement to your application.scss to bring your posts.scss file into that parent (or have an import tree or similar that auto-includes it) then the SCSS that you write in posts.scss becomes part of the one-and-only compiled/minified/magically available EVERYWHERE application.css that it compiles into. There is never any different CSS on any page in your entire application. All pages get the same CSS and JS through the Asset Pipeline unless you did something very non-standard.

If you aren't seeing the effect you are after, after making sure all of the above is accurate, then you may have to also consider that the CSS selector isn't correct, and the browser is ignoring it since it does not apply to the actual page when it renders to HTML.

Walter

> On May 31, 2018, at 7:45 PM, fugee ohu <[hidden email]> wrote:
>
> if i put my styling in application.scss it works but placing it in posts.scss has no effect on app/views/posts/index.html.erb
>
> --
> 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 [hidden email].
> To post to this group, send email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1560ea4b-4a80-4552-9379-f5349c2c08e2%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/EFED4BC9-4FD7-4F31-B24E-76B1358F7C87%40wdstudio.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: scss/sass for specific controller

fugee ohu


On Thursday, May 31, 2018 at 8:03:27 PM UTC-4, Walter Lee Davis wrote:
Read more about how the Asset Pipeline works here: <a href="http://guides.rubyonrails.org//asset_pipeline.html" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fguides.rubyonrails.org%2F%2Fasset_pipeline.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGYic0sYxkmEhPovNNXYGincg3bCg&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fguides.rubyonrails.org%2F%2Fasset_pipeline.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGYic0sYxkmEhPovNNXYGincg3bCg&#39;;return true;">http://guides.rubyonrails.org//asset_pipeline.html

TL;DR: If you add an import statement to your application.scss to bring your posts.scss file into that parent (or have an import tree or similar that auto-includes it) then the SCSS that you write in posts.scss becomes part of the one-and-only compiled/minified/magically available EVERYWHERE application.css that it compiles into. There is never any different CSS on any page in your entire application. All pages get the same CSS and JS through the Asset Pipeline unless you did something very non-standard.

If you aren't seeing the effect you are after, after making sure all of the above is accurate, then you may have to also consider that the CSS selector isn't correct, and the browser is ignoring it since it does not apply to the actual page when it renders to HTML.

Walter

> On May 31, 2018, at 7:45 PM, fugee ohu <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="x5dlAQHJAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">fuge...@...> wrote:
>
> if i put my styling in application.scss it works but placing it in posts.scss has no effect on app/views/posts/index.html.erb
>
> --
> 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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="x5dlAQHJAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonrails-ta...@googlegroups.com.
> To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="x5dlAQHJAgAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">rubyonra...@googlegroups.com.
> To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/rubyonrails-talk/1560ea4b-4a80-4552-9379-f5349c2c08e2%40googlegroups.com" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/1560ea4b-4a80-4552-9379-f5349c2c08e2%40googlegroups.com&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/rubyonrails-talk/1560ea4b-4a80-4552-9379-f5349c2c08e2%40googlegroups.com&#39;;return true;">https://groups.google.com/d/msgid/rubyonrails-talk/1560ea4b-4a80-4552-9379-f5349c2c08e2%40googlegroups.com.
> For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

Wow you're right What a revelation Thanks Walter 

--
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 [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/29f391d7-5edb-4ece-a314-60a9cc5ecb11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.