Permalink
Browse files

Imported assetgen from the ampify repo.

  • Loading branch information...
0 parents commit 8012665cf5b876cbec4f2ff25d48fc88959f6c35 @tav committed May 20, 2011
Showing with 1,237 additions and 0 deletions.
  1. +72 −0 .gitignore
  2. +19 −0 AUTHORS
  3. +3 −0 MANIFEST.in
  4. +147 −0 README.rst
  5. +207 −0 UNLICENSE
  6. +747 −0 assetgen/__init__.py
  7. +42 −0 setup.py
@@ -0,0 +1,72 @@
+# specific files/directories
+
+build
+dist
+assetgen.egg-info
+
+# minified css/js files
+
+*.min.js
+*.min.css
+
+# hidden files/directories
+
+.bzr
+.bzrignore
+.DS_Store
+.hg
+.hgignore
+.lock-wscript
+.sass-cache
+.sconsign*
+.svn
+
+# file patterns
+
+*#*
+*~
+*.5
+*.6
+*.8
+*.a
+*.dylib
+*.egg
+*.jar
+*.la
+*.lo
+*.o
+*.out
+*.pyc
+*.pyo
+*.so
+*.swp
+*.tar.bz2
+*.tar.gz
+*.tbz
+*.tbz2
+*.tgz
+*.rdb
+
+_testmain.go
+
+# file patterns (xcode)
+
+*.mode1v3
+*.mode2v3
+*~.nib
+*.pbxuser
+*.perspective
+*.perspectivev3
+*.swp
+*.tm_build_errors
+
+# file patterns (windows)
+
+*.dll
+*.exe
+*.ilk
+*.lib
+*.ncb
+*.pdb
+*.suo
+*.vcproj.*.*.user
19 AUTHORS
@@ -0,0 +1,19 @@
+Assetgen Authors
+================
+
+This is the official list of the Assetgen Authors ("The Authors"), listed in
+alphabetical order:
+
++----------------------------+--------------------+--------------------------+----------------+
+| Name | Nick | Email | Location |
++============================+====================+==========================+================+
+| `Tav`_ | tav | tav@espians.com | U.K. |
++----------------------------+--------------------+--------------------------+----------------+
+
+.. Please keep the listing in Alphabetical Order, thanks!
+
+.. _Tav: http://tav.espians.com
+
+By adding yourself to this list, you explicitly agree to affirm all of your
+Contributions to Assetgen ("The Work") to be covered by the Unlicense found in
+the UNLICENSE file.
@@ -0,0 +1,3 @@
+include AUTHORS
+include UNLICENSE
+include README.rst
@@ -0,0 +1,147 @@
+The ``assetgen`` tool generates static assets for web development. It is
+intended as a replacement for the various ad-hoc scripts that often gets written
+to build and manage JavaScript/CSS files.
+
+**Features**
+
+The tool is driven by the configuration you specify in an ``assetgen.yaml``
+file, e.g.
+
+::
+
+ # Example assetgen.yaml configuration
+
+ generate:
+
+ - js/base.js:
+ source:
+ - %(AMPIFY_ROOT)s/third_party/jslibs/json.js
+
+ - js/app.js:
+ source:
+ - static/js/Models.coffee
+ - static/js/Views.coffee
+ - static/js/Maps.coffee
+ uglify:
+ - --define-from-module
+ - consts
+ profile.dev:
+ uglify:
+ - --define-from-module
+ - consts-dev
+
+ - gfx/*:
+ source: static/gfx/*
+ type: binary
+
+ - css/site.css:
+ source:
+ - raw: |
+ // Public Domain (-) 2011 The Ampify Authors.
+ // See the Ampify UNLICENSE file for details.
+ - static/css/site.sass
+ depends:
+ - static/css/*.sass
+ - static/gfx/*
+ bidi: true
+ embed.path.root: static
+ embed.url.base: /.static/
+
+ prereqs:
+
+ - static/js/consts.js:
+ source: static/js/consts.coffee
+ compressed: false
+
+ - static/js/consts-dev.js:
+ source: static/js/consts-dev.coffee
+ compressed: false
+
+ env:
+ NODE_PATH.prefix: static/js
+
+ output.directory: appengine/static
+ output.hashed: true
+ output.manifest: appengine/assets.json
+
+ profile.dev:
+ css.compressed: false
+ js.compressed: false
+
+The default support includes:
+
+* Compiling CoffeeScript source files into JavaScript.
+
+* Minifying JavaScript through UglifyJS -- including the new constant folding
+ support.
+
+* Compiling and minifying SASS stylesheets into CSS.
+
+* Generating variants of the same stylesheet for both internationalisation
+ (flipping left to right) and for automatically embedding images as ``data:``
+ URIs to minimise latency.
+
+* Concatenating multiple source files into one file to minimise the number of
+ HTTP requests.
+
+* Creating distinct files with the hash of the content embedded in the filename
+ so as to work effectively with web caches.
+
+* Creating a JSON manifest file for use in your web app's static handlers.
+
+You can even control which config options gets used by specifying the
+``--profile`` parameter. This will override default values with the values
+specified for the given profile. So, in the above example, specifying
+``--profile dev`` will use all the ``profile.dev`` options.
+
+And, finally, you can specify custom handlers for ``assetgen`` to call when
+generating a file of a given ``type``. For example, to override the builtin
+``js`` handler with one which just lower-cases all the source content, create
+your extension, e.g. ``kickass-extension.py``::
+
+ class KickassAsset(Asset):
+
+ def generate(self):
+ content = ''.join(read(source).lower() for source in self.sources)
+ self.emit(self.path, content)
+
+ register_handler('js', KickassAsset)
+
+Then run ``assetgen`` with the ``--extension path/to/kickass-extension.py``
+parameter specified.
+
+**Usage**
+
+::
+
+ Usage: assetgen [<path/to/assetgen.yaml> ...] [options]
+
+ Note:
+ If you don't specify assetgen.yaml file paths, then `git
+ ls-files *assetgen.yaml` will be used to detect all config
+ files in the current repository. So you need to be inside
+ a git repository's working tree.
+
+ Options:
+ -h, --help show this help message and exit
+ -v, --version show program's version number and exit
+ --clean remove all generated files
+ --debug set debug mode
+ --extension=PATH specify a python extension file (may be repeated)
+ --force force rebuild of all files
+ --profile=NAME specify a profile to use
+ --watch keep running assetgen on a loop
+
+**Contribute**
+
+To contribute any patches simply fork the repository using GitHub and send a
+pull request to https://github.com/tav, thanks!
+
+**License**
+
+All of the code has been released into the `Public Domain
+<https://github.com/tav/assetgen/raw/master/UNLICENSE>`_. Do with it as you
+please.
+
+--
+Enjoy, tav <tav@espians.com>
Oops, something went wrong.

0 comments on commit 8012665

Please sign in to comment.