File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 11# web-compile
22
3- A CLI for compiling SCSS files to CSS, and associated pre-commit hook.
3+ [ ![ PyPI] [ pypi-badge ]] [ pypi-link ]
4+
5+ A CLI to compile/minify SCSS & JS, and associated pre-commit hook.
46
57This CLI is a small wrapper around [ libsass-python] ( https://github.com/sass/libsass-python ) ,
68[ rJSmin] ( http://opensource.perlig.de/rjsmin/ ) and [ jinja2] ( https://jinja.palletsprojects.com ) ,
@@ -11,6 +13,9 @@ and provide a pre-commit hook.
1113and will be trialled in [ sphinx-panels] ( https://github.com/executablebooks/sphinx-panels ) ,
1214and then [ sphinx-book-theme] ( https://github.com/executablebooks/sphinx-book-theme ) .
1315
16+ [ pypi-badge ] : https://img.shields.io/pypi/v/web-compile.svg
17+ [ pypi-link ] : https://pypi.org/project/web-compile
18+
1419## Installation
1520
1621To use directly as a CLI:
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ def test_js_hash(src_folder: Path):
108108 assert result .exit_code == 3 , result .output
109109
110110 assert (
111- src_folder / "dist" / "example1.36fb66cd32ac08ace70a7132f8173a9b .js"
111+ src_folder / "dist" / "example1.4725d39478f0b1676dc24f7b1bbee0ae .js"
112112 ).exists (), result .output
113113
114114
@@ -167,7 +167,7 @@ def test_full(src_folder: Path):
167167 text = (src_folder / "dist" / "example2.txt" ).read_text ("utf8" )
168168 # print(text)
169169 assert "example1.120bc14042c23711b51a07133e9dcabd.css" in text , text
170- assert "example1.36fb66cd32ac08ace70a7132f8173a9b .js" in text , text
170+ assert "example1.4725d39478f0b1676dc24f7b1bbee0ae .js" in text , text
171171 assert len (list ((src_folder / "dist" ).glob ("*" ))) == 7
172172
173173 # re-run
Original file line number Diff line number Diff line change @@ -356,6 +356,8 @@ def minify_js(
356356 )
357357 try :
358358 js_str = rjsmin .jsmin (input_path .read_text (), js_comments )
359+ # ensure compatibility with end-of-file-fixer
360+ js_str = js_str .rstrip () + os .linesep
359361 except Exception as err :
360362 compilation_errors [str (input_path )] = str (err )
361363 if continue_on_error :
@@ -438,6 +440,8 @@ def _get_compiled_name(path):
438440 jinja_str = jinja_env .from_string (
439441 input_path .read_text (jinja_encoding )
440442 ).render ()
443+ # ensure compatibility with end-of-file-fixer
444+ jinja_str = jinja_str .rstrip () + os .linesep
441445 except Exception as err :
442446 compilation_errors [str (input_path )] = str (err )
443447 if continue_on_error :
You can’t perform that action at this time.
0 commit comments