import all partials from specific directory??

224 views
Skip to first unread message

niksfirefly

unread,
Jun 3, 2011, 12:51:03 PM6/3/11
to Sass
is there a way to import all partials from specific directory??
something like
@import "partials/*"

Nathan Weizenbaum

unread,
Jun 3, 2011, 3:32:43 PM6/3/11
to sass...@googlegroups.com
No, this is something we've consciously avoided doing. The problem is that there's no good way of keeping the ordering of the files consistent; since CSS is an order-dependent language, this means that the styles would be able to change in confusing and hard-to-track-down ways.


--
You received this message because you are subscribed to the Google Groups "Sass" group.
To post to this group, send email to sass...@googlegroups.com.
To unsubscribe from this group, send email to sass-lang+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sass-lang?hl=en.


niksfirefly

unread,
Jun 4, 2011, 6:32:33 AM6/4/11
to Sass
ok but...
what if i use name convention in dirs for files (or use links like
debian's init.d startup order)
for example

_01_file.scss
_02_file.scss
_03_file.scss
...

i am not saying to make that sort of behaviour default but optional
(or plugin?)
i am not ruby programmer so i am asking here is there any plans or
solutions

regards

Chris Eppstein

unread,
Jun 4, 2011, 1:30:14 PM6/4/11
to sass...@googlegroups.com, Sass
I built this feature for rails at their request and despite my better judgement. I will extract it into a plugin.

Chris

Hunt & pecked on my iPhone... Sorry if it's brief!

Chris Eppstein

unread,
Jun 4, 2011, 7:33:00 PM6/4/11
to sass...@googlegroups.com
As promised:

https://github.com/chriseppstein/sass-globbing

Please report back after 1 year and let us know how many times this plugin caused issues with the cascade ;)

Chris

niksfirefly

unread,
Jun 5, 2011, 10:46:19 AM6/5/11
to Sass
Wow that was fast
thx :))))


On Jun 5, 1:33 am, Chris Eppstein <ch...@eppsteins.net> wrote:
> As promised:
>
> https://github.com/chriseppstein/sass-globbing
>
> Please report back after 1 year and let us know how many times this plugin
> caused issues with the cascade ;)
>
> Chris
>
>
>
>
>
>
>
> On Sat, Jun 4, 2011 at 10:30 AM, Chris Eppstein <ch...@eppsteins.net> wrote:
> > I built this feature for rails at their request and despite my better
> > judgement. I will extract it into a plugin.
>
> > Chris
>
> > Hunt & pecked on my iPhone... Sorry if it's brief!
>

Kurtis Rainbolt-Greene

unread,
Jun 16, 2011, 10:03:03 PM6/16/11
to sass...@googlegroups.com
The problem is that there's no good way of keeping the ordering of the files consistent; since CSS is an order-dependent language

Well, CSS is an order-dependant language, but some parts of SASS aren't. Specifically Mixin and Variable libraries aren't order dependent.

An example:

app/
  assets/
    stylesheets/
      mixins/
        _typography.sass
        _borders.sass
        _shapes.sass
      variables/
        _pallet.sass
        _defaults.sass
      stylesheet.css.sass

A general @import "mixins/", "variables/" would be great as it would allow for a generic plug-in-play system.

Chris Eppstein

unread,
May 6, 2013, 6:36:03 PM5/6/13
to sass...@googlegroups.com
For projects with dozens and dozens of imported files, the lack of built-in globbing is a pretty huge hassle.

I don't buy it. You have to have a file that imports all the things in a directory and remember to add an @import statement to it. If you forget, it's easy to debug. It's a mild annoyance at worst.

As I've said before, if you have globbing and you get weird bugs because you don't ascribe to one of the above methodologies and you are a noob who doesn't really understand specificity and the cascade, you will spend a /long/ time debugging this.

So yes, we are deciding that the pros for the pros don't outweigh the cons for the noobs.

Chris


On Sat, May 4, 2013 at 1:39 PM, Chris Malven <ch...@onedesigncompany.com> wrote:
No, this is something we've consciously avoided doing. The problem is that there's no good way of keeping the ordering of the files consistent; since CSS is an order-dependent language, this means that the styles would be able to change in confusing and hard-to-track-down ways.

The popularity of the SMACCS, OOCSS, and BEM CSS methodologies have made this argument pretty much irrelevant, unless the primary goal is preventing extremely inexperienced CSS developers from confusing themselves.

If your project's CSS is truly modular, and mine usually is these days, "@import "modules/*" isn't going to cause a single problem, because the compiled source order is irrelevant.

For projects with dozens and dozens of imported files, the lack of built-in globbing is a pretty huge hassle.

--
You received this message because you are subscribed to the Google Groups "Sass" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sass-lang+...@googlegroups.com.

To post to this group, send email to sass...@googlegroups.com.

Chris Malven

unread,
May 6, 2013, 6:44:44 PM5/6/13
to sass...@googlegroups.com
Fair enough, guess I didn't realize that addressing the lowest common denominator was such a big priority for the project. Cascade/specificity is CSS 101. If you don't get that, no amount of Sass babysitting is going to keep you from getting burned. I'm actually skeptical that there is a sizable portion of people with that low of a level of CSS understanding that are actually using Sass, and the docs certainly aren't catering to that audience. Many pros still don't even truly understand how @extend and %placeholder work.

Chris Malven

unread,
May 6, 2013, 6:50:16 PM5/6/13
to sass...@googlegroups.com
BTW, Chris, I'm using your separate sass-globbing gem and I love it. Thanks! :-)


On Monday, May 6, 2013 5:36:03 PM UTC-5, Chris Eppstein wrote:

Chris Eppstein

unread,
May 6, 2013, 7:32:47 PM5/6/13
to sass...@googlegroups.com
We are working to make the docs more friendly and as Sass is gaining traction and getting more tool support, the user base is becoming more beginner. I realize our adoption started and is strongest among the expert community, but I truly want Sass to be a tool that enables css experts to give simple frameworks to beginners for authoring highly customizable stylesheets without having to know the intricacies of css or x-browser support. I think we'll get there :)

Chris

P.S. Glad you like the globbing gem. I'm glad that it's a tool that people who know what they are doing can use safely.

Roy Tomeij

unread,
May 8, 2013, 2:02:01 AM5/8/13
to sass...@googlegroups.com
Slightly off topic, but you'd be surprised. After having presented on Sass at ~15 conferences and doing a fair amount of workshops, I'm absolutely positive that the internet is filled with crappy CSS, caused by people who abuse Sass on a daily basis.
Reply all
Reply to author
Forward
0 new messages