Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
alanhamlett committed Dec 15, 2016
0 parents commit 61bab7d
Show file tree
Hide file tree
Showing 10 changed files with 225 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
*.py[cod]

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
nosetests.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

virtualenv
venv
.DS_Store
13 changes: 13 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Flask-Static-Compress is written and maintained by Alan Hamlett and
various contributors:


Development Lead
----------------

- Alan Hamlett <alan.hamlett@gmail.com>


Patches and Suggestions
-----------------------

9 changes: 9 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

History
-------


1.0.0 (2016-12-15)
++++++++++++++++++

- Birth.
28 changes: 28 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD License
===========

Copyright (c) 2016 by the respective authors (see AUTHORS file).
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided
with the distribution.

THIS SOFTWARE AND DOCUMENTATION IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include README.rst LICENSE HISTORY.rst requirements.txt
recursive-include flask_static_compress *.py
69 changes: 69 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
Flask-Static-Compress
=====================

Auto-detects your static files for minification, combination, and versioning. Like Django-Compressor for Flask.


Installation
------------

::

pip install flask-static-compress


Usage
-----

Just wrap your existing css/js with a compress block and Flask-Static-Compress handles the rest::

{% compress 'css' %}
<link rel="stylesheet" type="text/sass" href="file.sass">
{% endcompress %}

{% compress 'js' %}
<script type="text/coffeescript" src="file.js"></script>
{% endcompress %}

Also, initialize the extension inside your Flask app::

from flask_static_compress import FlaskStaticCompress
app = Flask(__name__)
compress = FlaskStaticCompress(app)

All static assets inside a ``compress`` block are compressed into a single file, and the html is updated to use the new file when rendering the template.

The ``type`` attribute is used to decide which compressor to use for the asset.

Use `offline compression <https://github.com/jaysonsantos/jinja-assets-compressor#offline-compression>`_ for improved performance.

Create `custom compressors <https://github.com/jaysonsantos/jinja-assets-compressor#custom-compressors>`_ to support more types of static files.

Configuration
-------------

``COMPRESSOR_ENABLED`` Default: True

``COMPRESSOR_OFFLINE_COMPRESS`` Default: False

``COMPRESSOR_FOLLOW_SYMLINKS`` Default: False

``COMPRESSOR_DEBUG`` Default: False

``COMPRESSOR_OUTPUT_DIR`` Default: app.static_folder

``COMPRESSOR_STATIC_PREFIX`` Default: app.static_url_path

``COMPRESSOR_CLASSES`` Default::

[
'text/css': LessCompressor,
'text/coffeescript': CoffeeScriptCompressor,
'text/less': LessCompressor,
'text/javascript': JavaScriptCompressor,
'text/sass': SassCompressor,
'text/scss': SassCompressor,
]


Thanks to Jay Santos, creator of `jac <https://github.com/jaysonsantos/jinja-assets-compressor>`_. Flask-Static-Compress is just a wrapper around jac!
9 changes: 9 additions & 0 deletions flask_static_compress/__about__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
__title__ = 'Flask-Static-Compress'
__description__ = 'Auto-detects your static files for minification, combination, and versioning. Like Django-Compressor for Flask.'
__url__ = 'https://github.com/alanhamlett/flask-static-compress'
__version_info__ = ('1', '0', '0')
__version__ = '.'.join(__version_info__)
__author__ = 'Alan Hamlett'
__author_email__ = 'alan.hamlett@gmail.com'
__license__ = 'BSD'
__copyright__ = 'Copyright 2016 Alan Hamlett'
10 changes: 10 additions & 0 deletions flask_static_compress/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# -*- coding: utf-8 -*-
"""
Flask-Static-Compress
~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2016 Alan Hamlett.
:license: BSD, see LICENSE for more details.
"""


from jac.contrib.flask import JAC as FlaskStaticCompress
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Flask
jac==0.15.3
44 changes: 44 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from setuptools import setup

about = {}
with open('flask_static_compress/__about__.py') as f:
exec(f.read(), about)

packages = [
'flask_static_compress',
]

install_requires = [x.strip() for x in open('requirements.txt').readlines()]

setup(
name=about['__title__'],
version=about['__version__'],
license=about['__license__'],
description=about['__description__'],
long_description=open('README.rst').read(),
author=about['__author__'],
author_email=about['__author_email__'],
url=about['__url__'],
packages=packages,
package_dir={packages[0]: packages[0]},
include_package_data=True,
zip_safe=False,
platforms='any',
install_requires=install_requires,
classifiers=(
'Development Status :: 5 - Production/Stable',
'Environment :: Web Environment',
'Intended Audience :: Developers',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules',
),
)

0 comments on commit 61bab7d

Please sign in to comment.