Skip to main content
# Installation

pip install google_closure_fabric

or for latest dev version:

pip install https://github.com/batsuev/google-closure-fabric/archive/develop.zip

# Boilerplate
You can create new project using gclosureboilerplate script. Sample:

mkdir my-project
cd my-project
gclosureboilerplate .
fab bootstrap
fab build
fab serve

Open http://localhost:8000/ and enjoy. Or http://localhost:8000/index.min.html for compiled version.
All changes in sources will rebuild automatically.

# Boilerplate project structure
* my-project/
* src/
* js/
* css/
* templates/
* dist/
* pages/
* libs-google/
* fabfile.py

`src/js` - folder with javascript source code.
`src/css` - css sources.
`src/templates` - soy templates.
`dist` - compiled output.
`pages` - html files.
`libs-google` - folder for all google libs.
`fabfile.py` - fabric file with all required tasks.

# Google Closure libraries and tools

Running `fab bootstrap` in project folder will install all libraries to `libs-google` folder.
plovr installation is disabled in this example.

That will be installed:
* Google Closure Stylesheets (http://code.google.com/p/closure-stylesheets/)
* Google Closure Templates (https://developers.google.com/closure/templates/)
* Google Closure Compiler (https://developers.google.com/closure/compiler/)
* Google Closure Library (https://developers.google.com/closure/library/)
* Plovr (http://plovr.com)

# fabfile.py

import google_closure_fabric, os

PROJECT_PATH = os.path.dirname(__file__)
SRC = 'src/js'

def __get_css_builder():
css = google_closure_fabric.StylesheetsBuilder(PROJECT_PATH)
css.add_stylesheet('src/css/app.css')
css.set_output_file('dist/css/app.min.css')
return css

def __get_deps_builder():
deps = google_closure_fabric.DepsBuilder(PROJECT_PATH)
deps.set_source(SRC)
return deps

def __get_templates_builder():
soy = google_closure_fabric.TemplatesBuilder(PROJECT_PATH)
soy.add_template('src/templates/app.soy')
soy.set_output_path_format('src/js/templates/app.soy.js')
return soy

def __get_js_builder():
js_builder = google_closure_fabric.JSBuilder(PROJECT_PATH)
js_builder.set_output_file('dist/js/app.min.js')
js_builder.set_sources_folder('src/js')
js_builder.set_main_file('app.js')
return js_builder

def __get_linter():
linter = google_closure_fabric.Linter(PROJECT_PATH, strict=True, ignore_80_symbols=True)
linter.add_sources('src/js')
linter.add_exclude('src/js/templates/app.soy.js')
linter.add_exclude('src/js/soy.js')
linter.add_exclude('src/js/deps.js')
return linter

def bootstrap():
google_closure_fabric.bootstrap(
PROJECT_PATH,
dir_name='libs-google',
plovr=False
)

def serve():
deps = __get_deps_builder()
deps.set_custom_path_prefix('../'+SRC)
google_closure_fabric.serve(
PROJECT_PATH,
html_folder='pages',
deps_builder=deps,
stylesheets_builder=__get_css_builder(),
templates_builder=__get_templates_builder(),
js_builder=__get_js_builder()
)

def autofix():
__get_linter().autofix()

def build():
deps = __get_deps_builder()
deps.set_custom_path_prefix(SRC)
deps.set_output_file('src/js/deps.js')
deps.build()

__get_linter().lint()
__get_css_builder().build()
__get_templates_builder().build()
__get_js_builder().build()

Metadata

Release files for google_closure_fabric 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for google_closure_fabric 0.0.5
File Size Uploaded Provenance
google_closure_fabric-0.0.5.tar.gz 8.9 kB Without provenance Details

Release files / google_closure_fabric-0.0.5.tar.gz

Download URL google_closure_fabric-0.0.5.tar.gz
Size 8.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a78ea8581649a9273143f12e9294b81e7156508d6283c8cd2d2b93e9fe49dab8
BLAKE2b-256 checksum
How to use checksums
cfc2dddb8cff955b12730a38fdd366607965f99ac33fd956f27d861b3a71fc9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for google_closure_fabric 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page