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 1
1
# web-compile
2
2
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.
4
6
5
7
This CLI is a small wrapper around [ libsass-python] ( https://github.com/sass/libsass-python ) ,
6
8
[ rJSmin] ( http://opensource.perlig.de/rjsmin/ ) and [ jinja2] ( https://jinja.palletsprojects.com ) ,
@@ -11,6 +13,9 @@ and provide a pre-commit hook.
11
13
and will be trialled in [ sphinx-panels] ( https://github.com/executablebooks/sphinx-panels ) ,
12
14
and then [ sphinx-book-theme] ( https://github.com/executablebooks/sphinx-book-theme ) .
13
15
16
+ [ pypi-badge ] : https://img.shields.io/pypi/v/web-compile.svg
17
+ [ pypi-link ] : https://pypi.org/project/web-compile
18
+
14
19
## Installation
15
20
16
21
To 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):
108
108
assert result .exit_code == 3 , result .output
109
109
110
110
assert (
111
- src_folder / "dist" / "example1.36fb66cd32ac08ace70a7132f8173a9b .js"
111
+ src_folder / "dist" / "example1.4725d39478f0b1676dc24f7b1bbee0ae .js"
112
112
).exists (), result .output
113
113
114
114
@@ -167,7 +167,7 @@ def test_full(src_folder: Path):
167
167
text = (src_folder / "dist" / "example2.txt" ).read_text ("utf8" )
168
168
# print(text)
169
169
assert "example1.120bc14042c23711b51a07133e9dcabd.css" in text , text
170
- assert "example1.36fb66cd32ac08ace70a7132f8173a9b .js" in text , text
170
+ assert "example1.4725d39478f0b1676dc24f7b1bbee0ae .js" in text , text
171
171
assert len (list ((src_folder / "dist" ).glob ("*" ))) == 7
172
172
173
173
# re-run
Original file line number Diff line number Diff line change @@ -356,6 +356,8 @@ def minify_js(
356
356
)
357
357
try :
358
358
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
359
361
except Exception as err :
360
362
compilation_errors [str (input_path )] = str (err )
361
363
if continue_on_error :
@@ -438,6 +440,8 @@ def _get_compiled_name(path):
438
440
jinja_str = jinja_env .from_string (
439
441
input_path .read_text (jinja_encoding )
440
442
).render ()
443
+ # ensure compatibility with end-of-file-fixer
444
+ jinja_str = jinja_str .rstrip () + os .linesep
441
445
except Exception as err :
442
446
compilation_errors [str (input_path )] = str (err )
443
447
if continue_on_error :
You can’t perform that action at this time.
0 commit comments