Dalgona / Serum

Static website generator for Elixir fans
https://dalgona.dev/Serum
MIT License
320 stars 27 forks source link

sass processor? #47

Open bcardarella opened 5 years ago

bcardarella commented 5 years ago

Can the plugin system be used for processing sass files?

Dalgona commented 5 years ago

Yes, or maybe. Since I'm not a user of sass or other CSS preprocessor, I cannot give you a clear answer.

There should be many ways to implement the sass plugin, but the only idea I can come up with right now is to put the main functionality in build_succeeded/2 callback.

  1. Once Serum has successfully built the project, the build_succeeded/2 callback will be called for all enabled plugins, with the source directory and the output directory as arguments.

  2. At that moment, assets are already copied to /path/to/output/assets directory. And that directory may contain any unprocessed sass files.

  3. The plugin should find all sass files using an appropriate function (e.g. Path.wildcard/1) and run the external program using System.cmd/3 to replace all sass sources into CSS files.

Several things to consider:

bcardarella commented 5 years ago

I would advocate for a hook specifically to accommodate sass and other transpilers. Considering how close Serum is to Jekyll if sass was supported one could import Jekyll templates very easily which would make Serum a very attractive static site generator

Dalgona commented 5 years ago

I currently don't have any plans to make Serum Jekyll-compatible, or attractive to those who have used Jekyll. And I don't want people to regard Serum as "an Elixir implementation of Jekyll" or something else like that. Of course, I might be convinced to make such changes later, but that's a story of the future, far, far from now.

bcardarella commented 5 years ago

Would you accept a PR for a transpiler build step for plugins?

igalic commented 5 years ago

There is a package on Hex, but I'm not willing to use that...

@Dalgona, may i ask what's wrong with that package?

Dalgona commented 5 years ago

Honestly I have not checked the package yet, due to my personal schedules and lots of crazy stuffs after moving to Seoul :sweat_drops: I'll take a look at the package and see if it's an appropriate one for this project.