Skip to content

Never add source mappings at the end of nodes #38

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

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions lib/compress.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Compiler.prototype.import = function(node){
*/

Compiler.prototype.media = function(node){
return this.emit('@media ' + node.media, node.position, true)
return this.emit('@media ' + node.media, node.position)
+ this.emit('{')
+ this.mapVisit(node.rules)
+ this.emit('}');
Expand All @@ -69,7 +69,7 @@ Compiler.prototype.media = function(node){
Compiler.prototype.document = function(node){
var doc = '@' + (node.vendor || '') + 'document ' + node.document;

return this.emit(doc, node.position, true)
return this.emit(doc, node.position)
+ this.emit('{')
+ this.mapVisit(node.rules)
+ this.emit('}');
Expand All @@ -96,7 +96,7 @@ Compiler.prototype.namespace = function(node){
*/

Compiler.prototype.supports = function(node){
return this.emit('@supports ' + node.supports, node.position, true)
return this.emit('@supports ' + node.supports, node.position)
+ this.emit('{')
+ this.mapVisit(node.rules)
+ this.emit('}');
Expand All @@ -110,7 +110,7 @@ Compiler.prototype.keyframes = function(node){
return this.emit('@'
+ (node.vendor || '')
+ 'keyframes '
+ node.name, node.position, true)
+ node.name, node.position)
+ this.emit('{')
+ this.mapVisit(node.keyframes)
+ this.emit('}');
Expand All @@ -123,7 +123,7 @@ Compiler.prototype.keyframes = function(node){
Compiler.prototype.keyframe = function(node){
var decls = node.declarations;

return this.emit(node.values.join(','), node.position, true)
return this.emit(node.values.join(','), node.position)
+ this.emit('{')
+ this.mapVisit(decls)
+ this.emit('}');
Expand All @@ -138,7 +138,7 @@ Compiler.prototype.page = function(node){
? node.selectors.join(', ')
: '';

return this.emit('@page ' + sel, node.position, true)
return this.emit('@page ' + sel, node.position)
+ this.emit('{')
+ this.mapVisit(node.declarations)
+ this.emit('}');
Expand All @@ -149,7 +149,7 @@ Compiler.prototype.page = function(node){
*/

Compiler.prototype['font-face'] = function(node){
return this.emit('@font-face', node.position, true)
return this.emit('@font-face', node.position)
+ this.emit('{')
+ this.mapVisit(node.declarations)
+ this.emit('}');
Expand All @@ -160,7 +160,7 @@ Compiler.prototype['font-face'] = function(node){
*/

Compiler.prototype.host = function(node){
return this.emit('@host', node.position, true)
return this.emit('@host', node.position)
+ this.emit('{')
+ this.mapVisit(node.rules)
+ this.emit('}');
Expand All @@ -182,7 +182,7 @@ Compiler.prototype.rule = function(node){
var decls = node.declarations;
if (!decls.length) return '';

return this.emit(node.selectors.join(','), node.position, true)
return this.emit(node.selectors.join(','), node.position)
+ this.emit('{')
+ this.mapVisit(decls)
+ this.emit('}');
Expand Down
18 changes: 9 additions & 9 deletions lib/identity.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ Compiler.prototype.import = function(node){
*/

Compiler.prototype.media = function(node){
return this.emit('@media ' + node.media, node.position, true)
return this.emit('@media ' + node.media, node.position)
+ this.emit(
' {\n'
+ this.indent(1))
Expand All @@ -81,7 +81,7 @@ Compiler.prototype.media = function(node){
Compiler.prototype.document = function(node){
var doc = '@' + (node.vendor || '') + 'document ' + node.document;

return this.emit(doc, node.position, true)
return this.emit(doc, node.position)
+ this.emit(
' '
+ ' {\n'
Expand Down Expand Up @@ -113,7 +113,7 @@ Compiler.prototype.namespace = function(node){
*/

Compiler.prototype.supports = function(node){
return this.emit('@supports ' + node.supports, node.position, true)
return this.emit('@supports ' + node.supports, node.position)
+ this.emit(
' {\n'
+ this.indent(1))
Expand All @@ -128,7 +128,7 @@ Compiler.prototype.supports = function(node){
*/

Compiler.prototype.keyframes = function(node){
return this.emit('@' + (node.vendor || '') + 'keyframes ' + node.name, node.position, true)
return this.emit('@' + (node.vendor || '') + 'keyframes ' + node.name, node.position)
+ this.emit(
' {\n'
+ this.indent(1))
Expand All @@ -146,7 +146,7 @@ Compiler.prototype.keyframe = function(node){
var decls = node.declarations;

return this.emit(this.indent())
+ this.emit(node.values.join(', '), node.position, true)
+ this.emit(node.values.join(', '), node.position)
+ this.emit(
' {\n'
+ this.indent(1))
Expand All @@ -166,7 +166,7 @@ Compiler.prototype.page = function(node){
? node.selectors.join(', ') + ' '
: '';

return this.emit('@page ' + sel, node.position, true)
return this.emit('@page ' + sel, node.position)
+ this.emit('{\n')
+ this.emit(this.indent(1))
+ this.mapVisit(node.declarations, '\n')
Expand All @@ -179,7 +179,7 @@ Compiler.prototype.page = function(node){
*/

Compiler.prototype['font-face'] = function(node){
return this.emit('@font-face ', node.position, true)
return this.emit('@font-face ', node.position)
+ this.emit('{\n')
+ this.emit(this.indent(1))
+ this.mapVisit(node.declarations, '\n')
Expand All @@ -192,7 +192,7 @@ Compiler.prototype['font-face'] = function(node){
*/

Compiler.prototype.host = function(node){
return this.emit('@host', node.position, true)
return this.emit('@host', node.position)
+ this.emit(
' {\n'
+ this.indent(1))
Expand All @@ -219,7 +219,7 @@ Compiler.prototype.rule = function(node){
var decls = node.declarations;
if (!decls.length) return '';

return this.emit(node.selectors.map(function(s){ return indent + s }).join(',\n'), node.position, true)
return this.emit(node.selectors.map(function(s){ return indent + s }).join(',\n'), node.position)
+ this.emit(' {\n')
+ this.emit(this.indent(1))
+ this.mapVisit(decls, '\n')
Expand Down
16 changes: 0 additions & 16 deletions lib/source-map-support.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,6 @@ exports.emit = function(str, pos, startOnly) {

this.updatePosition(str);

if (!startOnly && pos && pos.end) {
this.map.addMapping({
source: sourceFile,
generated: {
line: this.position.line,
column: Math.max(this.position.column - 1, 0)
},
original: {
line: pos.end.line,
column: pos.end.column - 1
}
});

this.addFile(sourceFile, pos);
}

return str;
};

Expand Down