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

Add support for sourcemaps #14

Closed 10xLaCroixDrinker closed 10 years ago

10xLaCroixDrinker commented 11 years ago

Add an option to enable sourcemaps with Sass 3.3.0.alpha

balupton commented 11 years ago

Cool, sounds like you know more about this than I do! Want to do a pull request or point me in the right direction? :-)

10xLaCroixDrinker commented 11 years ago

I got a bit of a start on it earlier. Right now it's generating a lot of errors. I'll submit a pull request as soon as I get a chance to fix that.

balupton commented 11 years ago

Great thanks! :+1:

10xLaCroixDrinker commented 11 years ago

@balupton This will require passing the actual file instead of stdin. Are you open to that?

balupton commented 11 years ago

Hrmmm. That poses a really interesting shift.

Stdin is essential for say using eco in your sass, or if other plugins also do modifications to the file pre-sass compilation. In the future, with importers bevry/docpad#500 we will also support files that may not have a physical location on the file system, but rather a database instead...

It actually sounds like an issue on sass's side that it doesn't support source maps for stdin, if you could post a report on their issue tracker and chime me in, that would be great.

Taking a look at the pull request you've done up #15 the usage of files for sourcemaps currently sounds fine to me (at least until sass implement source maps for stdin their side). However, we need to continue to support stdin. So what about updating the pull request so that when sourcemaps are used, we use the file, and when they aren't we use stdin - good plan? Also, if you know a better solution, keen to hear it too!

10xLaCroixDrinker commented 11 years ago

Good plan. I made the change you suggested.

I'm a bit curious though about the use case for using eco on Sass. Could you provide one?

balupton commented 11 years ago

Cool, will check it out later.

For the use case of eco and css, I've had to do it a few times, most recently in the startup hostel website here: https://github.com/bevry/startup-hostel/blob/master/src/documents/styles/style.css.styl.eco#L138-L141

That will fetch all the people's avatar urls, download them locally with cachr, and then with a css post-processor embed the local file data directly into the compiled css file - final result here: http://startuphostel.org/styles/style.css?timestamp=1373415898518 - allowing us to have all of our many user avatars embedded into the one css file - cutting down on requests and download time signficantly.

10xLaCroixDrinker commented 11 years ago

Wow, that's a great idea. Thanks for sharing.

10xLaCroixDrinker commented 11 years ago

Did you consider using node-sass instead of the ruby gem?

balupton commented 11 years ago

@jking90 see #11 in reference to using node-sass

10xLaCroixDrinker commented 10 years ago

Closed by #15