Skip to main content

Utility for defining then downloading, concatenating and minifying your project's external static files

Project description

Build Status Coverage Status PyPI Status

Copyright (C) 2013-2015 Samuel Colvin

Python tool and library for downloading, concatenating and minifying external static files. Minification works with both javascript via jsmin and css via csscompressor.

Definition files can either be JSON or Python (see examples). So the versions of libraries used in your project can be defined in version control without the need for files from external projects.

CLI Usage

Define your static files thus: (grablib.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:

grablib

Library Usage

You can also call grablib from python:

import grablib

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

# or with options overridden
grablib.grab('path/to/definitions.json|py', verbosity=3)

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

grablib-0.1.8.tar.gz (8.5 kB view details)

Uploaded Source

File details

Details for the file grablib-0.1.8.tar.gz.

File metadata

  • Download URL: grablib-0.1.8.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for grablib-0.1.8.tar.gz
Algorithm Hash digest
SHA256 21bbbe56d30049b4008fd7947487f7d4917ff8ebecb516ed08485151ee359607
MD5 863721045cfce7f7ec2e65522d518a57
BLAKE2b-256 e6874783caadd849c57777c4ffc6a40892318a5456971f972052a19277c1008e

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page