Metadata-Version: 2.0
Name: grablib
Version: 0.2.1
Summary: Utility for defining then downloading and preprocessing external static files.
Home-page: https://github.com/samuelcolvin/grablib
Author: Samuel Colvin
Author-email: S@muelColvin.com
License: MIT
Keywords: css,sass,scss,build,static,download
Platform: any
Classifier: Environment :: Console
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: Implementation :: CPython
Requires-Dist: PyYAML (>=3.11)
Requires-Dist: click (>=6.6)
Requires-Dist: csscompressor (==0.9.3)
Requires-Dist: jsmin (==2.2.1)
Requires-Dist: requests (>=2.10.0)

grablib
=======

|Build Status| |codecov.io| |PyPI Status|

Copyright (C) 2013-2016 Samuel Colvin

Python tool and library for downloading, preprocessing external static
files. You can think of it a bit like bower+ for python.

Minification works with both javascript via
`jsmin <https://bitbucket.org/dcs/jsmin/>`__ and css via
`csscompressor <https://github.com/sprymix/csscompressor>`__.

Definition files can either be JSON or YAML (see
`examples <examples>`__).

CLI Usage
---------

Define your static files thus: (``grablib.json``)

.. code:: json

    {
      "download_root": "static_files",
      "sites":
      {
        "github": "https://raw.githubusercontent.com",
        "typeahead": "{{ github }}/twitter/typeahead.js/v0.10.2/dist"
      },
      "libs":
      {
        "{{ typeahead }}/typeahead.jquery.js": "js/ta_raw/{{ filename }}",
        "{{ typeahead }}/bloodhound.js": "js/ta_raw/{{ filename }}",
        "{{ github }}/twbs/bootstrap/v3.3.5/dist/css/bootstrap.min.css": "{{ filename }}",
        "{{ github }}/twbs/bootstrap/v3.3.5/dist/js/bootstrap.min.js": "{{ filename }}"
      },
      "minified_root": "static_files/minified",
      "minify":
      {
        "typeahead_combined.min.js": [".*/ta_raw/.*"]
      }
    }

Then download and minify you static files with just:

.. code:: shell

    grablib

Library Usage
-------------

You can also call grablib from python:

.. code:: python

    import grablib

    grablib.grab('path/to/definitions.json|yml')

    # or with options overridden
    grablib.grab('path/to/definitions.json|yml', overwrite=True)

.. |Build Status| image:: https://travis-ci.org/samuelcolvin/grablib.svg?branch=master
   :target: https://travis-ci.org/samuelcolvin/grablib
.. |codecov.io| image:: http://codecov.io/github/samuelcolvin/grablib/coverage.svg?branch=master
   :target: http://codecov.io/github/samuelcolvin/grablib?branch=master
.. |PyPI Status| image:: https://img.shields.io/pypi/v/grablib.svg?style=flat
   :target: https://pypi.python.org/pypi/grablib


