django-npm icon indicating copy to clipboard operation
django-npm copied to clipboard

Use aliases in NPM_FILE_PATTERNS to decrease nesting

Open hwalinga opened this issue 5 years ago • 0 comments

Usually you only need one file from a package. You can expose that single file using NPM_FILE_PATTERNS, but the nesting of folders can still be annoying.

For example, if I need jszip I will include:

NPM_STATIC_FILES_PREFIX = os.path.join('js', 'vendor')
NPM_FILE_PATTERNS = {"jszip": ["dist/jszip.min.js"]}

And now I get the file at 'static/js/vendor/jszip/dist/jszip.min.js'. The dist folder here is unneeded. In addition, I actually don't bother with the jszip directory, but want to have the file directly in the folder, as I am already nesting it using NPM_STATIC_FILES_PREFIX.

So, I just want to have the file in 'static/js/vendor/jszip.min.js'.

You might be able to allow for configuration by having the NPM_FILE_PATTERNS as a tuple with ("source", "destination").

hwalinga avatar Feb 25 '20 11:02 hwalinga