0

I'm working on a Ruby on Rails project and trying to teach myself SASS. I'm understanding for the most part, but I'm confused about why anyone would import partials (e.g. @import "_partial.scss")

Regardless of whether I store css rules (e.g. for a navbar) in a partial or a regular .scss file, I haven't been able to notice a difference in my website's layout in Chrome.

Thus, I ask: what is the benefit of importing partials (instead of importing regular .scss files?)

EDIT:

I've been asked to explain why this question isn't a duplicate of this question.

Let me clarify: I already know that partials are not compiled to regular .css files. I just don't understand the benefit of that aspect to them - the sprockets gem, which is included with rails by default, already combines all CSS into a single file.

Community
  • 1
  • 1
m81
  • 2,217
  • 5
  • 31
  • 47
  • Did you check one of our 100s of questions that already exist about Sass/Rails imports? http://stackoverflow.com/questions/23554270/why-rails-asset-pipeline-uses-require-instead-of-import – cimmanon May 10 '15 at 01:18
  • Yes, I did. I'm asking about the usage of partials specifically – m81 May 10 '15 at 01:19
  • 1
    Also related: http://stackoverflow.com/questions/17976140/false-positive-undefined-variable-error-when-compiling-scss – cimmanon May 10 '15 at 01:34
  • So do any of the linked questions provide the answer you're looking for then? – cimmanon May 10 '15 at 01:50
  • I believe this question is not a duplicate one ... but to @mchenja I would like to say ... you can not ask research based question ....people don't like this kind of questions ... just google and learn about it . – Mahabub Islam Prio May 10 '15 at 06:22
  • @mchenja The reason for `@import` is purely stylistic and organizational. For the same reason people don't write entire Java, C, or Python programs in one big file, it's nice to be able to have separate SCSS files pertaining to separate logical parts of your application. That's all. – Chris Clark May 14 '15 at 13:48

0 Answers0