https://github.com/lewangdev/montanus
A pythonic CDN Tool for old template engine based projects, such as JSP/PHP/ASP
https://github.com/lewangdev/montanus
cdn python
Last synced: about 1 year ago
JSON representation
A pythonic CDN Tool for old template engine based projects, such as JSP/PHP/ASP
- Host: GitHub
- URL: https://github.com/lewangdev/montanus
- Owner: lewangdev
- Created: 2018-08-15T06:46:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-24T02:56:08.000Z (over 7 years ago)
- Last Synced: 2025-01-02T23:51:55.905Z (about 1 year ago)
- Topics: cdn, python
- Language: Python
- Homepage:
- Size: 41 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A Tool for Static Resources Deployment
===============
## Principle
### Binary Resources First
Supported Binary File Types:
```python
__binary_file_exts = [
'.png', '.bmp', '.gif', '.ico',
'.jfif', '.jpe', '.jpeg', '.jpg'
]
```
### Text Files Parsed Recursively
Supported Text File Types:
```python
__text_file_exts = ['.css', '.js']
```
Extension Name of Template Files:
```python
__templates_exts = ['.jsp', '.html']
```
#### Example
index.html
```html
var dialog = require('dialog/dialog.js');
dialog.alert("I am a dialog!");
```
layout.css
```css
.bg{background: url(bg.png)}
```
#### Recursive Depth
index.html > layout.css > bg.png
index.html < layout_987cb34ea2.css < bg_087b4e5f67.png
### CDN
CSS
```css
@import url(path)
background:url(path)
background-image:url(path)
filter[Only IE]
```
JS
* AMD require
* Please avoid using `document.write img`
HTML, such as JSP, PHP etc.
```html
<link href="path">
<img src="path">
```
## HowTo
-----------
### Installation
-----------
```shell
sudo apt-get install python-pip
git clone https://github.com/thisiswangle/montanus.git
cd montanus
sudo pip install .
```
### Usage
-----------
```shell
(montanus)➜ montanus git:(master) ./montanus.py -h
Montanus.
Usage:
montanus.py <templates_path> [--with-static-files-path=<p> | --with-protocol=<p> | --with-domains=<l> | --with-md5-len=<l> | --with-md5-concat-by=<c> | --with-conf=<f> | -d]
montanus.py (-h | --help)
montanus.py (-v | --version)
Options:
-h --help Show this help message
-v --version Show version
-d --delete Delete all sources
--with-static-files-path=<p> Set static file path. If not set, the value will be the same as template_path
--with-protocol=<p> Set protocol [Default: http]
--with-domains=<d> Set CDN domains[Default: ]
--with-md5-len=<l> Set MD5 Length [Default: 10]
--with-md5-concat-by=<c> Set MD5 concatenator [Default: -]
--with-conf=<f> Set config file path
```
```shell
montanus 'awesome_project/src/main/webapp'
```
### How to work with Jenkins
-----------
Add this code before building process
```shell
WEB_HOME=${WORKSPACE}/src/main/webapp
echo "Goto ${WEB_HOME} to build a version tag for all static files"
montanus ${WEB_HOME} --with-domains=s0.awesome-domain.com,s1.awesome-domain.com
```
Add this code after building
```shell
pwd
git clean -df
```