Spea / SpBowerBundle

Symfony2 Bundle to handle asset dependencies with bower
231 stars 44 forks source link

Installing bower dependancies for the project #122

Open trsteel88 opened 9 years ago

trsteel88 commented 9 years ago

Is there a way to install bower dependancies that aren't inside a bundle? e.g, I want to install from app/Resources/config/bower.json as well as my bundles.

Spea commented 9 years ago

You could adjust the config_dir for the bundle configuration (see configuration reference for more information). But sadly you still have to use some bundle for it. So currently there is no "nice way" to define the location not tied to a bundle

giosh94mhz commented 9 years ago

@trsteel88 I'm a bit late, but here's how I've done to have a "standard" bower configuration:

sp_bower:
    bundles:
        AcmeDemoBundle: # well, a placeholder actually
            config_dir: %kernel.root_dir%/config        # symfony app standard
            asset_dir:  %kernel.root_dir%/../web/vendor # standard-ish
            cache:      %kernel.cache_dir%              # symfony standard

and then in the symfony project root, I've added the following .bowerrc (should match your config above):

{
    "cwd": "app\/config\/",
    "directory":"..\/..\/web\/vendor\/"
}

Now you can use the same configuration from command line.

@Spea Sorry if I go off-topic, but why isn't this configuration the default? I have previous experience with both Symfony (2+ years) and Bower (half a year), but the current configuration scheme puzzled me. Why are the configuration split in bundles sections (other than distributing bower.json in a bundle)? Should I file a DX issue?