Make No JS Mess in Your Symfony2 Project: Use component

Instead of doing a mess of the repo, I found it is more clean to just use composer and component-installer from @robloach and fetch the highcharts.js library for instance:

{
    // ...
    "config": {
        // ....
        "component-dir": "web/components"
    },
    "require": {
        // ...
        "component/highcharts": "3.0.5"
    },
    "repositories": [
        {
            "type": "package",
            "package": {
                "name": "component/highcharts",
                "type": "component",
                "version": "3.0.5",
                "source": {
                    "url": "https://github.com/highslide-software/highcharts.com.git",
                    "type": "git",
                    "reference": "v3.0.5"
                },
                "extra": {
                    "component": {
                        "scripts": [
                            "js/highcharts.src.js"
                        ]
                    }
                },
                "require": {
                    "robloach/component-installer": "*"
                }
            }
        }
    ]
}

From here on you can just get the js file on your asset lines. Small trick, hope you appreciate it.

Encouragements in all good,

@cordoval

2 thoughts on “Make No JS Mess in Your Symfony2 Project: Use component

Leave a Reply to Konrad Podgórski Cancel reply

Your email address will not be published. Required fields are marked *