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:
5959 [default: compressed]
6060 -m, --sourcemap Output source map.
6161 -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: #]
6467
6568 -t, --translate TEXT Source to output path translations, e.g.
6669 '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):
7171 is_flag = True ,
7272 help = (
7373 "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)."
7575 ),
7676)
77+ @click .option (
78+ "--hash-prefix" ,
79+ default = "#" ,
80+ show_default = True ,
81+ help = "Prefix to use for hashed filenames." ,
82+ )
7783@click .option (
7884 "-t" ,
7985 "--translate" ,
@@ -129,6 +135,7 @@ def run_compile(
129135 verbose ,
130136 exit_code ,
131137 no_git ,
138+ hash_prefix ,
132139 test_run ,
133140):
134141 """Compile all SCSS files in the paths provided.
@@ -246,12 +253,12 @@ def run_compile(
246253 if hash_filenames :
247254 css_out_path = out_dir / (
248255 out_name
249- + "#"
256+ + hash_prefix
250257 + hashlib .md5 (css_str .encode (encoding )).hexdigest ()
251258 + ".css"
252259 )
253260 # 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" ):
255262 if path == css_out_path :
256263 continue
257264 if verbose :
You can’t perform that action at this time.
0 commit comments