stevenschobert / metalsmith-sass

Sass plugin for Metalsmith.
MIT License
48 stars 22 forks source link

Multimatch filtering to source files #11

Open ubenzer opened 9 years ago

ubenzer commented 9 years ago

Hello,

Is it possible to add a filtering mechanism, so it can be determined which files to be processed to css and which files should be left out as-is?

Thanks for this plugin!

stevenschobert commented 9 years ago

Hey @ubenzer, thanks for the suggestion.

Out of curiosity, was there anything in particular about the other Metalsmith plugins (like metalsmith-ignore) that didn't work out for you?

ubenzer commented 9 years ago

Hey @stevenschobert ,

metalsmith-ignore fully deletes a file, so it doesn't appear on the build folder. I want some sass files not to be converted to css and stay as uncompiled files.

The reason behind this is: I am trying to write a metalsmith-powered blog engine and I only want theme-related scss files to be compiled. If user adds a scss files to their post (say, he is writing a scss tutorial and adds an example scss file to his post to be downloaded) I don't want to compile it to css and leave it as-is.

stevenschobert commented 9 years ago

@ubenzer Ah. Really interesting use-case.

I could see how adding some sort of ignore option would be nice to have, but I'm wondering whether that option would completely remove the file, or just not compile it. Which do you think the most expected behavior would be?

ubenzer commented 9 years ago

Just leave it as is, not compile.

I can come up with a PR this week if I have time, if that is OK with you.

karneaud commented 8 years ago

What's the state of this as it can be useful. I have my main sass files and I have some framework sass files that I import into my main sass. Things go as planned but the frame work sass is being compiled as a .css into the output as well which is not what I want as its already being compiled into the main sass file thus

app/ -----/framework/sass/style.scss ----/sass/main.scss

my metalsmith.json has

"metalsmith-sass":
    {
        "files":["app/sass/*.scss"],
        "includePaths":["app/sass"],
        "outputDir":"css",
        "outputStyle": "expanded"
    },

my main.scss has

@import "../framework/sass/style";

what I get outputted

css/ -----style.css -----main.css

why is it outputting the style.css?

irisli commented 8 years ago

Hi. I was going to open an issue but then saw this issue that described what I was looking for.

In my use case, I have a documentation site that pulls in a standalone angular webapp (that contains both a index.scss and index.css). The files in the webapp directory are to be left as-is. With metalsmith-in-place and metalsmith-layouts, i can specify pattern: "*.handlebars" to only use handlebars on those specific files.

It would be great to have a config to only process specific files. For me, I would use pattern: styles/** and then only sass files in the parent website gets processed while child standalone webapps are left as-is.