https://github.com/lightsing/flask-npm
embrace npm modules with flask
https://github.com/lightsing/flask-npm
Last synced: 2 months ago
JSON representation
embrace npm modules with flask
- Host: GitHub
- URL: https://github.com/lightsing/flask-npm
- Owner: lightsing
- License: bsd-3-clause
- Created: 2018-07-08T00:21:42.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-08T01:21:28.000Z (almost 8 years ago)
- Last Synced: 2025-03-21T20:47:36.716Z (about 1 year ago)
- Language: Python
- Size: 2.93 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Flask-NPM
=========
Flask-NPM is a Flask extension which makes it easy to
serve static files from node_modules
## Installation ##
### PyPI ###
Flask-NPM is available on PyPI! You can install it with pip.
```sh
pip install Flask-NPM
```
### Manual ###
If you want to do it the hard way you can clone the repository and
install Flask-NPM in a virtualenv.
1. Clone it `git clone https://github.com/lightsing/Flask-NPM.git`
2. Enter it `cd Flask-NPM`
3. Create a virtualenv and enter it (Optional) `virtualenv venv && source venv/bin/activate`
4. Install it `python setup.py install`
## Instructions ##
After Flask-NPM is installed you will be able to import the `flask.ext.NPM`
packages. There is only one thing you care about inside the package
which is the `NPM` class.
```python
from flask.ext.NPM import NPM
```
There are two ways to use the `NPM` class.
1. Add the application object at construction time
```python
app = Flask(__name__)
NPM(app)
```
2. Or initialize the application with `NPM.init_app`
```python
NPM = NPM()
app = Flask(__name__)
NPM.init_app(app)
```