eleventy-plugin-sass icon indicating copy to clipboard operation
eleventy-plugin-sass copied to clipboard

respect output & input directories

Open jalberto opened this issue 5 years ago • 6 comments

First, thanks for your plugin :)

I will like to use it, but it doesn't respect 11ty config. I have all my site in an src dir, this plugin will find every sass (even partials) and create one file per sass it find (it should only create the non-partials ones, also, it will create a directory structure to mimic srs in the ourput dir.

so src/_assets/main.sass -> _site/src/assets/main.css and src/_assets/sass/_partial.sass -> _site/src/assets/sass/_partial.css I expect a single _site/assets/main.css

can this be configured?

Thanks!

jalberto avatar Jan 31 '20 12:01 jalberto

@jalberto can you give a repo where this happens? then I can check it out

Sonaryr avatar Jan 31 '20 12:01 Sonaryr

@Sonaryr Here's a minimal repo that exposes the bug: https://gitlab.com/zerodogg/eleventy-plugin-sass-output-dir

I would expect it to write public/test.css, but what it actually writes is public/site/test.css

zerodogg avatar Feb 05 '20 00:02 zerodogg

@zerodogg @jalberto thanks for the example, I cloned it here https://github.com/Sonaryr/eleventy-plugin-sass-output-dir-example What I noticed is that you didn't changed the config for the plugin. By default it watches ['**/*.{scss,sass}', '!node_modules/**'] behind the scenes it works with the vinyl-fs package (like gulp).

If you look at https://github.com/Sonaryr/eleventy-plugin-sass-output-dir-example/commit/92381e4b5f836219c65c0e48ccf133c4020d52b9 you will notice I changed the watch option for the plugin to ['site/**/*.{scss,sass}', '!node_modules/**'] causing it to behave like you guys want. I even added a partial sass file to verify it does not create a css file for it.

Is this sufficient for both your use cases @jalberto and @zerodogg?

Sonaryr avatar Feb 05 '20 07:02 Sonaryr

@Sonaryr That resolves the issue for my usecase, yeah. It would be nice if it did it on its own though. If not, perhaps just a note in the documentation for the plugin saying to change "watch" when using the dir.input eleventy setting?

zerodogg avatar Feb 05 '20 14:02 zerodogg

thanks for the plugin, Is there a way to configure the output path for this plugin? that would be very useful, as i want to inline my css... For example i would like to set something like: output: './src/assets/css/'

btw, i just installed the @NARKOZ un merged pull request code, and work like a charm... so the solution just a merge away!

toybreaker avatar Apr 17 '20 07:04 toybreaker

This is already fixed via #12 which has been merged. You can close this issue. 😄

patricknelson avatar Mar 12 '22 03:03 patricknelson