Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sass processor? #47

Open
bcardarella opened this issue Jun 8, 2019 · 6 comments
Open

sass processor? #47

bcardarella opened this issue Jun 8, 2019 · 6 comments

Comments

@bcardarella
Copy link

Can the plugin system be used for processing sass files?

@Dalgona
Copy link
Owner

Dalgona commented Jun 12, 2019

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:

  • The plugin probably use an external command to run the sass compiler. (There is a package on Hex, but I'm not willing to use that...) Therefore the plugin should be implemented to work on any major platform.

  • The sass processor may bundle the output into one CSS file (does it?). Plugin users should be directed to add appropriate <link rel="stylesheet" ...> tags referencing valid CSS assets.

  • The plugin won't work with Serum themes, as plugins are not aware of themes at all... yet.

@bcardarella
Copy link
Author

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
Copy link
Owner

Dalgona commented Jun 12, 2019

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
Copy link
Author

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

@igalic
Copy link
Contributor

igalic commented Jun 12, 2019

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
Copy link
Owner

Dalgona commented Jun 16, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants