Concat JS
Table of Contents
Use case
This small app aim to provide automatic concatenation of javascript (or any other file) files. Typical use case is to combine sets of small js files and bundle then into one functionnal script for each «web page», and reduce the overhead of multiple web requests.
Installation
First of all install the app from PyPi
pip install django-concat-js
After installing the package, add concat_js in in your INSTALLED_APPS settings
INSTALLED_APPS = (
...
'concat_js',
)
Settings
You need to configure the app before using it. It's done by adding a setting in your settings.py file
CONCAT_JS = {
"JSON_DEPS": a Path to main JSON file,
"CONCAT_ROOT": a Path,
"CREATE_SOURCEMAPS": False,
"LINT_COMMAND": False,
"FILTER_EXTS": (".js", ),
"LINT_BASE": False
}
The main setting here is JSON_DEP which should point to a JSON file. It can be a Path or a string.
This files contains a list of objects with following attributes
{
"relative_to": "{BASE_DIR}/my_path/",
"dest": "first_destination.js",
"src": [
"src/first_source.js",
"src/second_source.js"
]
}
relative_tois an optionnal string containing an absolute path to a directory. All other path in this object are considered relative to this directory. Defaults toCONCAT_ROOT(see below). You can useBASE_DIR(defined in django defaultsettings.pyfile) orCONCAT_ROOTas format placeholder.srcis a list of relative path to files to be concatenated. The result is in....destis the relative path to the concatenated file.
If you want to, you can name each bundle and use the more verbose
[
"my_wonderful_name",
bundle_spec
]
where bundle_spec is an object described above.
Other settings
CONCAT_ROOTis aPathor string setting. See aboce for meaning. It defaults toBASE_DIRCREATE_SOURCEMAPis a boolean, which defaults toFalse. IfTrue, each bundling will also create a sourcemap file named{dest}.mapLINT_COMMANDmust beFalseor a command string used to invoke a linter for each file before concatenation.FILTER_EXTSis an iterable of extension strings which defaults to the tuple(".js", ). Only files with given extensions will be watched for changes.LINT_BASEis eitherFalse(the default) or a path to a directory. Files in this directory will be linted just before watching for changes.
## Usage
Once configured, you can watch for changed files with
python manage.py watch_js
License
django-concat-js is distributed under the terms of the MIT license.
Metadata
Release files for django-concat-js 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_concat_js-0.3.2.tar.gz | 15.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_concat_js-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.5 kB
Release files / django_concat_js-0.3.2.tar.gz
| Download URL | django_concat_js-0.3.2.tar.gz |
|---|---|
| Size | 15.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
735dc2fc8311ce8ba94a91ca4e228a835e2cb3ffd99c50a215c6c7b908b80c33
|
|
BLAKE2b-256 checksum How to use checksums |
9ed0aae97c35a520c584e29bac7ea00a1a7501517d077249dff16d064b4dc05b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.3
|
Release files / django_concat_js-0.3.2-py3-none-any.whl
| Download URL | django_concat_js-0.3.2-py3-none-any.whl |
|---|---|
| Size | 19.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
851d027af7a148128a33a976d8c3f789b865e562369b010602bb20ecc517f299
|
|
BLAKE2b-256 checksum How to use checksums |
721a11b4d9037bf38f1031f8c7ff7cb7793641170297e64b73253fe8bcc4432b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.3
|
Security for django-concat-js 0.3.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.