Skip to content
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

If source map is generated, there should be no source line comments #551

Closed
mgol opened this issue Oct 17, 2014 · 10 comments
Closed

If source map is generated, there should be no source line comments #551

mgol opened this issue Oct 17, 2014 · 10 comments

Comments

@mgol
Copy link

mgol commented Oct 17, 2014

With libsass 3.0.0 even if source maps are generated, the resulting CSS file still contains source line comments like:

  /* line 137, /Users/mgol/Documents/projects/bn/cbn/repo/polona-gui/app/core-styles/lists */

This is unnecessary; Ruby Sass doesn't generate these comments. An example:

The following SCSS:

a,
div {
    top: 0;
}

is generated by Sass 3.4.5 to the following CSS (when output style is set to nested):

a,
div {
  top: 0; }

/*# sourceMappingURL=styles.css.map */

Meanwhile, libsass 3.0 converts it to:

/* line 2, /Users/mgol/Documents/projects/bn/cbn/repo/polona-gui/app/styles.scss */
a, div {
  top: 0; }

/*# sourceMappingURL=styles.css.map */

Note the comment line

Another issue with this example: #552

@mgreter
Copy link
Contributor

mgreter commented Oct 18, 2014

this "feature" is enabled by setting "source_comments" to true by the implementors. The api has sligthly changed, so I guess your implementation hasn't kept up to this change. But it is defenetly configurable by implemtors!

@HamptonMakes
Copy link
Member

@mzgol what adapter are you using?

@mgol
Copy link
Author

mgol commented Oct 18, 2014

@hcatlin grunt-sass

Michał Gołębiowski

@simonexmachina
Copy link
Contributor

The line comments are still included for me when source_comments is set to map.

I'm using node-sass via broccoli-sass, and the options that are being passed to node-sass are:

{ file: '/Users/simonwade/dev/Workspace/franq/dashboard/tmp/tree_merger-tmp_dest_dir-bkPrg5Jr.tmp//app/styles/app.scss',
  includePaths:
   [ '/Users/simonwade/dev/Workspace/franq/dashboard/tmp/tree_merger-tmp_dest_dir-bkPrg5Jr.tmp',
     'bower_components/foundation/scss',
     'bower_components/foundation-icon-fonts' ],
  outFile: '/Users/simonwade/dev/Workspace/franq/dashboard/tmp/sass_compiler-tmp_cache_dir-RhluQU2W.tmp/assets/dashboard.css',
  success: [Function],
  error: [Function],
  imagePath: undefined,
  outputStyle: undefined,
  sourceComments: 'map',
  sourceMap: 'dashboard.css.map',
  precision: undefined }

@scottwio
Copy link

Same problem here line comments are generated when sourceComments is set to Map. grunt-sass version 0.16.0

@mgreter
Copy link
Contributor

mgreter commented Oct 27, 2014

This looks like a documentation bug in node-sass. As I just checked they still say in their main readme: If your sourceComments option is set to map, sourceMap allows .... The c_interface has been cleaned up, since it didn't make any sense to have two options to enable source maps. Internally source_comments is now a boolean and only enables, you may have guessed it, the source comments you are seeing. It's enough now to just set source_map to generate them.

You probably can just not set sourceComments to get the desired result!

//CC @am11

@am11
Copy link
Contributor

am11 commented Oct 27, 2014

@mgreter is right; the documentation needs to be updated.

You need to set sourceComments: none or sourceComments: default and it will not produce "debug comments".

Tested with latest node-sass npm, v1.0.3.

@mgreter mgreter closed this as completed Oct 27, 2014
@am11
Copy link
Contributor

am11 commented Oct 27, 2014

BTW I think we need to change this behavior: https://github.com/sass/node-sass/blob/0f62c1817cba77c45ad3f27ac20ee604c1e7883b/sass.js#L56 and make it none instead of map.

@andrew thoughts?

@andrew
Copy link

andrew commented Oct 28, 2014

@am11 yeah I think your right

@am11
Copy link
Contributor

am11 commented Oct 28, 2014

This way by default (if souceComments is missing), there won't be any debug info in the code. Just the good old clean plain CSS code.. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants