docpad / docpad-plugin-sass

Adds support for the SASS and SCSS CSS pre-processors to DocPad. It also supports the Compass framework.
Other
13 stars 6 forks source link

Added Bundler support #19

Closed patocallaghan closed 10 years ago

patocallaghan commented 11 years ago

This pull-request adds Bundler support. I use Bundler as it allows me to use different version gems for different projects. Setting the bundler option to true, it will use the equivalent of bundle exec to compile the Sass files.

I may need some guidance on adding a test case however. I couldn't work out if all the test cases use the same config settings or whether I could add a specific set of options just for the Bundler test case. Also to implement this test case it would require you to include a GemFile, GemFile.lock and have the Bundler gem installed. So I'm not sure if you want all those extra dependencies on the test cases.

andruhon commented 10 years ago

It looks like this improvement is really useful one.

Following setting would help with bundler but it does not:

    plugins:
        sass:
            scssPath: '/pathto_project/bundle exec sass'
            sassPath: '/pathto_project/bundle exec sass'

I thought that this setting does not work due to spaces in it and I also tried to create my own sh/bat files containing these commands, but it does not working too.

erutan commented 10 years ago

With 3.3 on the horizon some kind of version targeting for gems, bundler or otherwise, would be very helpful.

balupton commented 10 years ago

@patocallaghan any thoughts on @andruhon issue?

patocallaghan commented 10 years ago

@balupton and @andruhon if I understand the problem correctly the bundle bin file resides in the same place as the sass and scss files. bundle is a global call rather than one that is local to the project.

so it shouldn't be saying /pathto_project/bundle exec sass but instead /pathto_ruby/bin/bundle exec /pathto_ruby/bin/sass

andruhon commented 10 years ago

@balupton,

After @patocallaghan 's fix {command} array contains following elements just before safeps.spawn: 0: "somewhere\bin\bundle.bat" 1: "exec" 2: "somewhere\bin\scss.bat" 3: "--stdin" 4: "--no-cache" 5: "--load-path" 6: "D:\Dev\docpad_test\terabyte\http\content\styles" 7: "--compass" 8: "--style" 9: "expanded" 10: "--require" 11: "compass" 12: "--require" 13: "rgbapng" 14: "--require" 15: "breakpoint" 16: "--require" 17: "ceaser-easing"

Existing plugin has following elements: 0: "bundle exec sass" 1: "--stdin" 2: "--no-cache" 3: "--load-path" 4: "D:\Dev\docpad_test\terabyte\http\content\styles" 5: "--compass" 6: "--style" 7: "expanded" 8: "--require" 9: "compass" 10: "--require" 11: "rgbapng" 12: "--require" 13: "breakpoint" 14: "--require" 15: "ceaser-easing"

It obvious that in second case command contain spaces in first element and safeps won't call this command.

andruhon commented 10 years ago

Just created another pull request fixing this issue: https://github.com/docpad/docpad-plugin-sass/pull/26

balupton commented 10 years ago

Merged in #26 and added instructions to the readme. Publishing now.

balupton commented 10 years ago

Published to v2.6.1 — thanks everyone!