Skip to content

Remove comments with sourcemap #130

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

Merged
merged 3 commits into from
Mar 8, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Stop forcing debugging comments when creating sourcemap
  • Loading branch information
tisdall committed Mar 4, 2016
commit 3b8b9e0de4b570a3c062e841d69dd2bca8579357
2 changes: 1 addition & 1 deletion pysass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ PySass_compile_filename(PyObject *self, PyObject *args) {
context = sass_make_file_context(filename);
options = sass_file_context_get_options(context);

if (source_comments && PySass_Bytes_Check(source_map_filename)) {
if (PySass_Bytes_Check(source_map_filename)) {
size_t source_map_file_len = PySass_Bytes_GET_SIZE(source_map_filename);
if (source_map_file_len) {
char *source_map_file = (char *) malloc(source_map_file_len + 1);
Expand Down
2 changes: 0 additions & 2 deletions sass.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,6 @@ def my_importer(path):
raise CompileError('source_map_filename is only available with '
'filename= keyword argument since it has to be '
'aware of it')
if source_map_filename is not None:
source_comments = True
try:
include_paths = kwargs.pop('include_paths') or b''
except KeyError:
Expand Down
24 changes: 7 additions & 17 deletions sasstests.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,8 @@ def normalize_path(path):
'''

A_EXPECTED_CSS_WITH_MAP = '''\
/* line 6, SOURCE */
body {
background-color: green; }
/* line 8, SOURCE */
body a {
color: blue; }

Expand All @@ -60,8 +58,8 @@ def normalize_path(path):
'sources': ['test/a.scss'],
'names': [],
'mappings': (
';AAKA,AAAA,IAAI,CAAC;EAHH,gBAAgB,EAAE,KAAM,GAQzB;;EALD,AAEE,IAFE,'
'CAEF,CAAC,CAAC;IACA,KAAK,EAAE,IAAK,GACb'
'AAKA,AAAA,IAAI,CAAC;EAHH,gBAAgB,EAAE,KAAM,GAQzB;EALD,AAEE,'
'IAFE,CAEF,CAAC,CAAC;IACA,KAAK,EAAE,IAAK,GACb'
),
}

Expand All @@ -71,7 +69,6 @@ def normalize_path(path):
'''

B_EXPECTED_CSS_WITH_MAP = '''\
/* line 2, SOURCE */
b i {
font-size: 20px; }

Expand All @@ -97,10 +94,8 @@ def normalize_path(path):

D_EXPECTED_CSS_WITH_MAP = '''\
@charset "UTF-8";
/* line 6, SOURCE */
body {
background-color: green; }
/* line 8, SOURCE */
body a {
font: '나눔고딕', sans-serif; }

Expand Down Expand Up @@ -446,10 +441,7 @@ def test_compile_source_map(self):
source_map_filename='a.scss.css.map'
)
self.assertEqual(
A_EXPECTED_CSS_WITH_MAP.replace(
'SOURCE',
normalize_path(os.path.abspath(filename))
),
A_EXPECTED_CSS_WITH_MAP,
actual
)
self.assert_source_map_equal(A_EXPECTED_MAP, source_map)
Expand Down Expand Up @@ -612,7 +604,7 @@ def replace_source_path(s, name):
'sources': ['../test/b.scss'],
'names': [],
'mappings': (
';AAAA,AACE,CADD,CACC,CAAC,CAAC;EACA,SAAS,EAAE,IAAK,'
'AAAA,AACE,CADD,CACC,CAAC,CAAC;EACA,SAAS,EAAE,IAAK,'
'GACjB'
),
},
Expand All @@ -632,7 +624,7 @@ def replace_source_path(s, name):
'sources': ['../test/d.scss'],
'names': [],
'mappings': (
';;AAKA,AAAA,IAAI,CAAC;EAHH,gBAAgB,EAAE,KAAM,GAQzB;;'
';AAKA,AAAA,IAAI,CAAC;EAHH,gBAAgB,EAAE,KAAM,GAQzB;'
'EALD,AAEE,IAFE,CAEF,CAAC,CAAC;IACA,IAAI,EAAE,0BAA2B,'
'GAClC'
),
Expand Down Expand Up @@ -667,7 +659,7 @@ def test_wsgi_sass_middleware(self):
self.assertEqual(200, r.status_code)
src_path = normalize_path(os.path.join(src_dir, 'a.scss'))
self.assert_bytes_equal(
b(A_EXPECTED_CSS_WITH_MAP.replace('SOURCE', src_path)),
b(A_EXPECTED_CSS_WITH_MAP),
r.data
)
self.assertEqual('text/css', r.mimetype)
Expand Down Expand Up @@ -818,9 +810,7 @@ def test_sassc_sourcemap(self):
self.assertEqual('', self.out.getvalue())
with open(out_filename) as f:
self.assertEqual(
A_EXPECTED_CSS_WITH_MAP.replace(
'SOURCE', normalize_path(src_filename)
),
A_EXPECTED_CSS_WITH_MAP,
f.read().strip()
)
with open(out_filename + '.map') as f:
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy