-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add support for sourcemaps #28
Conversation
Hey @szarouski, this is great! But can you fix the build ? Right now, it's not working. See https://travis-ci.org/t32k/grunt-csso/jobs/176102824. You can run it locally before pushing, |
dc91a63
to
86d5c92
Compare
Fixed. Don't know how I missed travis 😛 |
@nitriques does it look good now? |
}).css; | ||
}); | ||
css = result.css; | ||
map = result.map || map; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The || map
is useless IMHO
} | ||
catch (err) { | ||
return next(err); | ||
} | ||
|
||
if (proceed.length === 0) { | ||
if (css.length === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be better to do !css
Yes! Sorry @szarouski I was a lot busy in the past weeks. I've made another quick review: could you check it/argue with me/fix it ? Thanks! |
86d5c92
to
8e4ad56
Compare
@nitriques Thanks for review! 🍺 Updated. |
} | ||
if (map) { | ||
grunt.file.write(mapDest, map); | ||
grunt.log.write('File ' + chalk.cyan(mapDest) + ' created' + (options.report ? ': ' : '.')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last thing ! Both writes could happen in parallel with fs.writeFile
. If you do not want to do it, just tell me ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@szarouski ping!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nitriques Hey, I didn't forget, just didn't have time yet. I'll look into that during weekend :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok great ! Ping me if you have any questions.
If you can't do it, I'll merge as is and do it ;) Thanks again!!!
8e4ad56
to
671ebd6
Compare
671ebd6
to
22598a9
Compare
fs.readFileSync('tmp/sourcemap.css', 'utf8'), | ||
'should create sourcemap'); | ||
test.equal( | ||
fs.readFileSync('test/expected/sourcemap.css.map', 'utf8').replace(/(\\r)?\\n/g, eol === '\r\n' ? '\\r\\n' : '\\n'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to write those replacements due to the way how sourcemaps are generated. Hacky but tests pass on windows, so i hope it is not a big deal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I'll try to create a better solution ;) Not a problem right now ;) Maybe force EOL to LF in tests...
@szarouski Thanks! Check out the attached commits I've just pushed ;) And please test on Windows ! |
Grunt offers us a way to set globally the EOL characters so we should use it. Simply usign the OS version is not ideal since many Windows users would like to have LF endings. Re #28
Which is faster then writing a file Re #28
async.map will do exactly what we need here, i.e. wait for 1 or 2 operations to complete. Report any errors. Re #28
Grunt offers us a way to set globally the EOL characters so we should use it. Simply usign the OS version is not ideal since many Windows users would like to have LF endings. Re #28
Which is faster then writing a file Re #28
async.map will do exactly what we need here, i.e. wait for 1 or 2 operations to complete. Report any errors. Re #28
@nitriques, checked out latest version from
|
Ok thanks. At home, I do not have a Windows machine (I've tested in on Ubuntu) but I do at work. Will test ASAP. |
I have no problems running the test on my Windows machine. I think it depends on your git config: if git converts LF to CRLF, then the test might not pass. I've juste pushed a .gitattributes file to make sure your git config does not make the test fails. |
I had an issue even after I pulled, so I decided to delete everything except for .git and try again. After reset everything works fine. Good job 👍 |
No description provided.