Run RequireJS (r.js) without node.
Project description
Run RequireJS (r.js) from Python without requiring Node or Rhino. Leverages PyMiniRacer plus a minimal JS environment to make r.js think it’s running in node.
Usage
python-requirejs is available via PyPI:
pip install requirejs
API
import requirejs
requirejs.optimize(
appDir=".",
baseUrl="js/",
modules=[{
"name": "main",
}]
dir="../build",
)
Hopefully, all of the available build options for r.js will Just Work. If you find any discrepancies, please open a ticket to let us know.
This library is meant to be a drop-in replacement for node r.js -o app.build.json, and is tested by comparing its output with that command. However, since the optimize API is being called as a function, you may need to set the working directory explicitly to avoid any unexpected differences in how relative paths are computed:
import requirejs
import json
with open('app/app.build.json') as f:
config = json.load(f)
requirejs.optimize(
config,
working_directory="app/" # Unique to python-requirejs
)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file requirejs-0.2.2.tar.gz.
File metadata
- Download URL: requirejs-0.2.2.tar.gz
- Upload date:
- Size: 237.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c90fc1ebf197048531c9bb1f039c994f3bd97f6cd834a04d581af6f52c6427d
|
|
| MD5 |
54147c7495e3ab28f176c67b18bf1bee
|
|
| BLAKE2b-256 |
351480ecdd3e22b213701963d5dbafc3cab31551dcd53bfc4f998b97c406b347
|
File details
Details for the file requirejs-0.2.2-py3-none-any.whl.
File metadata
- Download URL: requirejs-0.2.2-py3-none-any.whl
- Upload date:
- Size: 240.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.5.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c883b0fa45820c649e4d3f7336fd7de405040b39fbd1e0fe4b8696bf015ccf4
|
|
| MD5 |
e27e28b4be43406b6bca6895906a9d8f
|
|
| BLAKE2b-256 |
07ccb7cf1923188433c5aeb82bebadcba2ebd78fcb4389c12d5c77e8c7cd106f
|