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

Verify env support for filters #937

Closed
2 tasks
denisdefreyne opened this issue Aug 28, 2016 · 4 comments
Closed
2 tasks

Verify env support for filters #937

denisdefreyne opened this issue Aug 28, 2016 · 4 comments
Milestone

Comments

@denisdefreyne
Copy link
Member

@bburton said in #859:

As much as I like the idea of adding environment support, this change makes certain assumptions that will cause problems with certain filters. For instance, the compass filter creates a .sass-cache folder in the project directory where nanoc compile is run. It's quite possible other filters may create temporary folders where files are cached.

As a result, the only safe way to use this feature is to only compile to one environment in a given project folder and not compile different environments in the same project folder.

Sure it's possible to configure the sass compiler to cache to a specific location but the setup is complicated because the environment setting needs to be passed to the compass config.rb and used to set the sass :cache_location property. Not only that, the configuration has to be made to config.rb so it's possible to run the compass command by itself outside of nanoc and have it pick up the right environment location.

Compass also supports environments so it would be ideal if the environment setting configured for Nanoc could be passed into the compass config.rb but that's a bit beyond the current topic.

However, aside from the filters nanoc supports out of the box, even if all of them were reviewed and fixed if necessary, there's no guarantee that third-party filters aren't writing or caching files to the project directory.

Even if switching environments to compile into the same folder is not supported, environment support is still very useful when building with one environment configuration such as development in its own folder, then push changes to a Git repository, e.g. github.com, then in a different folder configured as the production environment perform a git pull and recompile.

I see two action points here:

  • Verify that all built-in filters behave properly when switching environments.
  • Ensure that the documentation for writing filters explicitly mentions that caches might become invalid due to an environment switch. This might mean that filters need to have access to the current environment, which is currently not the case.
@denisdefreyne
Copy link
Member Author

This might be not so much of an issue if the caches are invalidated properly. For example, for Sass I believe that either the caches will not differ between environments, or Sass will know that it is invoked differently and invalidate the caches.

@denisdefreyne
Copy link
Member Author

Also, Compass is deprecated and so I don’t believe support for it should be added.

@denisdefreyne
Copy link
Member Author

(wrong button)

denisdefreyne added a commit that referenced this issue Oct 23, 2016
@denisdefreyne
Copy link
Member Author

I’ll close this for now, as I don’t believe this will be a problem. I added a spec in e1c9cdd that tests the behavior of Sass and caching with environments.

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

1 participant