codelovers/assetic-jshint-bundle

Symfony bundle that registers the codelovers/assetic-jshint filter

dev-master 2014-03-09 11:47 UTC

This package is not auto-updated.

Last update: 2024-11-09 17:03:45 UTC


README

This Symfony 2 Bundle registers an Assetic filter to pass JavaScript files through JsHint on compilation.

Installation

Install the bundle using composer (see http://getcomposer.org/ for more information about composer) by adding it to your composer.json file and running composer update:

    // composer.json

    "require": {
        // ...
        "codelovers/assetic-jshint": "dev-master",
        "codelovers/assetic-jshint-bundle": "dev-master"
    }

Then just add the bundle to your AppKernel.php file:

<?php
// in AppKernel::registerBundles()
$bundles = array(
    // ...
    new CodeLovers\JsHintBundle\CodeLoversJsHintBundle(),
    // ...
);

Install JsHint

You will need to install JsHint to use this bundle. We assume you already have installed node.js:

npm install -g jshint

Configuration

All you need to configure is the path to your jshint binary. Most likely it will be /usr/bin/jshint (that's the default value of the bundle's configuration) or /usr/local/bin/jshint

code_lovers_js_hint:
    jshint_bin: ~

Usage

Simply apply the filter to your JavaScript assets:

{% javascripts
 '@AcmeDemoBundle/Resources/js/app.js'
 filter='jshint' output='compiled/js/app.js' %} ... {% endjavascripts %}