getnikola / plugins

Extra plugins for Nikola
https://plugins.getnikola.com/
MIT License
59 stars 95 forks source link

Sass plugin: template inheritance? #166

Closed felixfontein closed 8 years ago

felixfontein commented 8 years ago

The current implementation of the Sass (and I guess, same for LESS) compiler plugin looks for sass/targets in the themes folders, and once it found it, will copy all .scss and .sass files from the folder where it found the file to cache/sass. This implies that you can only use Sass in one theme in the theme inheritance path: only the .scss/.sass files from the latest theme in the chain are considered.

Wouldn't it make more sense to copy all .scss/.sass files from all themes to cache/sass (resolve collisions by taking the latest) instead?

To implement this, it would make sense to add a functionality to nikola.utils which collects all files in a theme subfolder for a chain (with collisions resolved as usual). This could then be used by the Sass and LESS compilers to implement this behavior.

felixfontein commented 8 years ago

(I just remembered that the copy_assets plugin already does something like that. I'd prefer to change that plugin as well to use a new function in nikola.utils, instead of spreading a similar logic into three different plugins.)

ralsina commented 8 years ago

I think the less plugin, at least does something like it. It copies all .less files in the chain into the cache, in fact that's why it uses the cache.

https://github.com/getnikola/plugins/blob/master/v7/less/less.py#L77

I may be understanding the code wrong, but that's what it seems to be doing on a quick read.

On Tue, Sep 13, 2016 at 8:47 PM Felix Fontein notifications@github.com wrote:

The current implementation of the Sass (and I guess, same for LESS) compiler plugin looks for sass/targets in the themes folders, and once it found it, will copy all .scss and .sass files from the folder where it found the file to cache/sass. This implies that you can only use Sass in one theme in the theme inheritance path: only the .scss/.sass files from the latest theme in the chain are considered.

Wouldn't it make more sense to copy all .scss/.sass files from all themes to cache/sass (resolve collisions by taking the latest) instead?

To implement this, it would make sense to add a functionality to nikola.utils which collects all files in a theme subfolder for a chain (with collisions resolved as usual). This could then be used by the Sass and LESS compilers to implement this behavior.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/getnikola/plugins/issues/166, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAGK4x7ss3pxnoBgKb_ojxRW9WRoDEAks5qpzX6gaJpZM4J8Q2o .

felixfontein commented 8 years ago

Ah, I overlooked that part. That part doesn't handle collisions, though (only the loop above does).