File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -59,8 +59,11 @@ Options:
59
59
[default: compressed]
60
60
-m, --sourcemap Output source map.
61
61
-h, --hash-filenames Add the content hash to filenames:
62
- <filename>#<hash>.css (old hashes will be
63
- removed).
62
+ <filename><hash-prefix><hash>.css (old
63
+ hashes will be removed).
64
+
65
+ --hash-prefix TEXT Prefix to use for hashed filenames.
66
+ [default: #]
64
67
65
68
-t, --translate TEXT Source to output path translations, e.g.
66
69
'src/scss:dist/css' (can be used multiple
Original file line number Diff line number Diff line change @@ -71,9 +71,15 @@ def config_provider(file_path: str, cmd_name: str):
71
71
is_flag = True ,
72
72
help = (
73
73
"Add the content hash to filenames: "
74
- "<filename># <hash>.css (old hashes will be removed)."
74
+ "<filename><hash-prefix> <hash>.css (old hashes will be removed)."
75
75
),
76
76
)
77
+ @click .option (
78
+ "--hash-prefix" ,
79
+ default = "#" ,
80
+ show_default = True ,
81
+ help = "Prefix to use for hashed filenames." ,
82
+ )
77
83
@click .option (
78
84
"-t" ,
79
85
"--translate" ,
@@ -129,6 +135,7 @@ def run_compile(
129
135
verbose ,
130
136
exit_code ,
131
137
no_git ,
138
+ hash_prefix ,
132
139
test_run ,
133
140
):
134
141
"""Compile all SCSS files in the paths provided.
@@ -246,12 +253,12 @@ def run_compile(
246
253
if hash_filenames :
247
254
css_out_path = out_dir / (
248
255
out_name
249
- + "#"
256
+ + hash_prefix
250
257
+ hashlib .md5 (css_str .encode (encoding )).hexdigest ()
251
258
+ ".css"
252
259
)
253
260
# remove old hashes
254
- for path in out_dir .glob (out_name + "# *.css" ):
261
+ for path in out_dir .glob (f" { out_name } { hash_prefix } *.css" ):
255
262
if path == css_out_path :
256
263
continue
257
264
if verbose :
You can’t perform that action at this time.
0 commit comments