BlessCSS / bless

CSS Post-Processor
blesscss.com
MIT License
282 stars 60 forks source link

Add input AST with SourceMap attribution support #33

Open dotherightthing opened 10 years ago

dotherightthing commented 10 years ago

I'm running grunt-bless on my CSS after it has been run through grunt-contrib-compass.

grunt-bless is a wrapper for bless.js, while grunt-contrib-compass is a wrapper for Compass.

When grunt-contrib-compass is run with the latest version of Compass (1.0.0.alpha.19), with:

"options": {
    "sourcemap": true
}

.. a sourcemap is generated for each CSS file that is generated:

print.css
print.css.map
screen.css
screen.css.map

The .map file can be read by browsers like Google Chrome, to trace styles back to the original Sass file.

This works fine - up until the point when grunt-bless is run on the Compass output. Now we have:

print.css
print.css.map
screen.css
screen.css.map
screen.blessed.css

There are three problems here:

  1. screen.blessed.css.map should be generated
  2. screen.blessed.css.map should contain the pointer "file": "screen.blessed.css" (rather that "file": "screen.css")
  3. screen.blessed.css should contain the pointer /*# sourceMappingURL=screen.blessed.css.map */

Thanks!

paulyoung commented 10 years ago

Thanks. 4.0 is coming up and is the best candidate for this.

booleanbetrayal commented 10 years ago

I imagine this is a rather annoying feature for implementation, but I can vouch for its importance as we move to a proper piping workflow.

mevbg commented 9 years ago

Hey Paul,

Do you have any news about how version 4.0 of bless.js is going on?

I also have the issue with the stripped comment for my source maps.

Martin

paulyoung commented 9 years ago

Hi @martinmethod!

I just changed jobs :computer:, moved :house:, and had another baby :baby:, so things have been on hold for a while.

Planning on giving this some attention soon so that it can be in a better place to accept contributions.

adam-lynch commented 9 years ago

:+1: https://github.com/adam-lynch/gulp-bless/issues/14

For me it would be best if bless returned the computed sourcemap programmatically. If I have the following code (using version 3 just for this example FYI):

new (bless.Parser)({
    output: outputFilePath,
    options: blessOpts
}).parse(contents, function(err, blessedFiles, numSelectors) {          

Then each blessedFiles should have a map / sourcemap property as well as content, etc. This would allow for gulp sourcemap support.

paulyoung commented 8 years ago

I think this issue can now be closed since sourcemaps were added as part of #63.

mtscout6 commented 8 years ago

Agreed!

inukshuk commented 8 years ago

Just a quick question, it looks like it isn't possible to pass-in source maps, is that correct? In other words, if I already generate source maps in node sass, modify them in autoprefixer and then want to run bless on the result -- this is a scenario that is not supported yet, or is it? Thanks a lot for your work!

mtscout6 commented 8 years ago

@inukshuk You're right, though it wouldn't take much to change it to do so. We parse out the AST at https://github.com/BlessCSS/bless/blob/master/src/chunk.js#L40. Basically we just need to decouple the AST parsing from the chunking which is a move in the right direction. I'm too busy to tackle it this week, but would be open to a pull request that addresses it.

I'll re-open this issue and change the title to reflect this.

inukshuk commented 8 years ago

@mtscout6 thanks for the confirmation. Not much time this week either, but I'll see if I can take a stab at it,

ericnewton76 commented 7 years ago

looks like this is still waiting to be implemented

i see that v3.1.10 has sourcemaps support... awesome!