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

Adding a new LESS CSS plugin #27

Open
zerg000000 opened this issue Jun 15, 2015 · 2 comments
Open

Adding a new LESS CSS plugin #27

zerg000000 opened this issue Jun 15, 2015 · 2 comments

Comments

@zerg000000
Copy link

The reference code repo

https://github.com/zerg000000/cryogen-less.git

It required one lines of changes in the core project( the dorun line).

    (sass/compile-sass->css!
     {:src-sass sass-src
      :dest-sass (str "../public" blog-prefix "/" sass-dest)
      :ignored-files ignored-files
      :base-dir "resources/templates/"})
    (dorun (map #(apply (resolve (symbol %)) [config]) (:extra config)))))
@yogthos
Copy link
Member

yogthos commented Jun 15, 2015

It seems to me that this code should go in the init method of the plugin. The whole point of plugins is that the core project should be agnostic about their behavior. If the current plugin loading mechanism isn't flexible enough to support the functionality then it needs to be updated, but we shouldn't put plugin specific logic in the core.

I think the sass config should be a key in the config.edn, the plugin should read the config and look for that key to find its configuration.

@zerg000000
Copy link
Author

Sass code is the current code in cryogen-core. Refactoring it to a plugin would be interesting.
The last line of code was the code I want to add to cryogen-core.

(dorun (map #(apply (resolve (symbol %)) [config]) (:extra config))))

It takes a sequence of function name from config.edn and execute them in sequence. It just a way to allow user to hook something to the default compile-assets pipeline.

However, I agree, It is lack of safeguard and have so many rooms for user or plugin developer to make mistakes.

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

2 participants