Skip to main content

JS Min script that provides cmd line and python processors

Project description

lpjsmin for minifying js files

We need to handle several minification goals within the Launchpad codebase. This helps to create a single lib to help handle all of the cases and allow it to be flexibly used in more projects.

Usage

cmd line

You can pass the cmd line lpjsmin either a filename or a directory and it’ll process the file(s) adding a $fname-min.js next to the original file. This is used for things like minifying files in the combo directory. You can just let it know the root of the combo directory and it’ll minify all files it finds in there.

$ lpjsmin -p static/js/
$ lpjsmin -p static/js/myapp.js

python usage

You can import the module and minify in your own build scripts either via just filename and directory.

import lpjsmin
lpjsmin.minify('static/js')
lpjsmin.minify('static/js/myapp.js')

If you need to be able to customize the name or location of the minified files, wrap the lpjsmin script in your own build script and pass it the in/out streams.

import lpjsmin
lpjsmin.minify_stream(
    open('static/js/myapp.js'),
    open('/tmp/myapp.minified.js', 'w')
)

stdin

You can also just pass text at the script via stdin and it’ll minimze it back out to you.

$ cat file.js | lpjsmin

News

0.6

  • Add tox testing support and drop buildout.

  • Add Python 3 support.

  • Use PEP 508 environment markers.

0.5

Release date: 11-June-2012

  • Ignore any files that don’t end in .js

  • Fix broken logic detecting if this file was already minified or not that allowed multiple nested minifications (filename-min-min-min.js)

0.4

Release date: 21-Feb-2012

  • Fix typo in the setup.py

0.3

Release date: 21-Feb-2012

  • Add argparse as a conditional dep for older Python versions.

0.2

Release date: 21-Feb-2012

  • Move the file/directory based minifying to the -p/–path cmd line flag.

  • Support minifying off of stdin and sending to stdout if no path is specified.

  • Fix the ipdb dependency that should not have been there.

0.1

Release date: 17-Feb-2012

  • Initial pulling out of the Launchpad utils directory.

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

lpjsmin-0.6.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

lpjsmin-0.6-py2.py3-none-any.whl (10.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file lpjsmin-0.6.tar.gz.

File metadata

  • Download URL: lpjsmin-0.6.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/3.6.5

File hashes

Hashes for lpjsmin-0.6.tar.gz
Algorithm Hash digest
SHA256 bae3acd055395864457bd0c907ff21d407dbcf8d6952b1633d72f704416e2616
MD5 ffdfb134ce15808a8de3ccd5aa469f35
BLAKE2b-256 c8ad058064cd97aa528555614dbd082e2b8700ac02e61dc4eae128504369c99f

See more details on using hashes here.

File details

Details for the file lpjsmin-0.6-py2.py3-none-any.whl.

File metadata

  • Download URL: lpjsmin-0.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.23.3 CPython/3.6.5

File hashes

Hashes for lpjsmin-0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6d2f013e11395ec7515612ea43dde508d5245ff5ac272b589d7ef74db0910341
MD5 c2afa3ac056d4ceec5d9250099f1e5b8
BLAKE2b-256 d182b53cb9c2dba920555ce3e6528c89469224cf38952d8576bde7b05703c9e3

See more details on using hashes here.

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