metalsmith-sass icon indicating copy to clipboard operation
metalsmith-sass copied to clipboard

Multimatch filtering to source files

Open ubenzer opened this issue 11 years ago • 6 comments

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!

ubenzer avatar Oct 24 '14 20:10 ubenzer

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?

stevenschobert avatar Oct 27 '14 15:10 stevenschobert

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.

ubenzer avatar Oct 28 '14 07:10 ubenzer

@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?

stevenschobert avatar Nov 09 '14 16:11 stevenschobert

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.

ubenzer avatar Nov 09 '14 19:11 ubenzer

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?

karneaud avatar Sep 21 '15 14:09 karneaud

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.

irisli avatar Sep 29 '15 20:09 irisli