Giter Club home page Giter Club logo

spbowerbundle's Introduction

SpBowerBundle

The SpBowerBundle adds support for handling asset dependencies with bower in a nice way.

Features included:

  • Install bower packages in your bundles with one command
  • Register all installed bower packages as assets so they can be used in templates
  • Unit tested

Caution: This bundle is developed in sync with symfony's repository.

⚠️ This Project Has Been Deprecated ⚠️

Thank you for your interest in contributing to this bundle. Unfortunately, I do not plan to continue maintaining this bundle.

With symfony 3.0 assetic was removed (at least in the standard edition) and some time later the new Webpack Encore component was announced, thus (and the fact that I stopped using bower myself a while ago) I will no longer maintain this bundle.

Feel free to use this bundle as-is but I strongly recommend using other tools for asset management (like grunt, gulp or webpack). If you have a project depending on this bundle, I would recommend on migrating it to something else.

If someone wants to take over this bundle, let me know and I will gladly transfer the ownership.

Thanks for your support and using this bundle over the years.


Bower >= 1.0.0

Since version 0.8 the bundle fully supports bower >= 1.0.0. If you used version 0.7 before, you might want to read the upgrade instructions to 0.8.

Bower < 1.0.0

If you are still using a bower version < 1.0.0, you must use a Version lower or equal to 0.7 from this bundle.

Build Status Latest Stable Version Total Downloads

Documentation

Read the Documentation for master

Read the Documentation for 0.1

Installation

All the installation instructions are located in the documentation.

License

This bundle is under the MIT license. See the complete license in the bundle:

Resources/meta/LICENSE

Reporting an issue or a feature request

Issues and feature requests are tracked in the Github issue tracker.

When reporting a bug, it may be a good idea to reproduce it in a basic project built using the Symfony Standard Edition to allow developers of the bundle to reproduce the issue by simply cloning it and following some steps.

spbowerbundle's People

Contributors

acrobat avatar alfonsfoubert avatar benjaminpaap avatar chellem avatar dafish avatar eidsonator avatar eymengunay avatar fran6co avatar groganz avatar hallabro avatar ivan1986 avatar jamarisi avatar jmsbot avatar kaiwa avatar lavoiesl avatar luishdez avatar markitosgv avatar milaney avatar ninir avatar pborreli avatar spea avatar sstok avatar thierrymarianne avatar uwej711 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spbowerbundle's Issues

sp:bower:install command always fails the first time on a clean project

When the "install_on_warmup" option is disabled (default), you need to install the dependencies manually by running "app/console sp:bower:install". But the very first time that you run this command (or any other symfony command for that matter), you'll always receive the following exception:

 [Sp\BowerBundle\Bower\Exception\MappingException]
  Bower returned an invalid dependency mapping. This mostly happens when the dependencies are not yet installed or if you are using an old version of bower.

After running the command "app/console" once, part of the cache is warmed up and the next time that I run "app/console sp:bower:install" it will install the dependencies.

The exception is right: The dependencies are not installed yet, but it is impossible to install the dependencies. Version 0.6 works perfectly fine. This change was introduced in commit 016d31a .

This might be related to the errors mentioned in #32 .

Images are not being loaded

After the command sp:bower:install, the CSS and JS are generated correctly, but the images are not.

Bootstrap tries to load the image from the img/ dir, and they are inside the specific bundle dir.

Same issue with Font Awesome, except it uses fonts.

Do we have a solution?

Can't find Hinclude js

I'm trying to install hinclude with SpBowerBundle.

When I run sp:bower:install, it installs the library correctly, but when I try to load using:

{% javascripts
    "@hinclude_js"
%}

When I run the app/console assetic:dump command, it generates the hinclude_js file, but empty.

It doesn't load, I'm not sure why. Any ideas?

Deploy to production system where bower is not available

Currently we are facing the following situation:

  • SpBowerBundle is in use in a Symfony2 project
    -- (by following all steps from https://github.com/Spea/SpBowerBundle/blob/master/Resources/doc/index.md, except step 7)
  • Building everything locally on dev machines respectively on a build server (jenkins) works well (bower is installed)
  • On production, SpBowerBundle also wants to run bower locally, what I do not want to install on a production server

Or is it really necessary to install node, npm and bower?

Exception on sp:bower:install after updating symfony/symfony from 2.3.4 to 2.3.5

Hi,

Yesterday I updated the symfony/symfony package on my application from 2.3.4 to 2.3.5, and then I just started getting this exception when running the sp:bower:install command:

[Symfony\Component\Debug\Exception\ContextErrorException]

Warning: stream_select(): No stream arrays were passed in /var/www/html/t14s_2013/vendor/symfony/symfony/src/Symfony/Component/Process/ProcessPipes.php line 260

Script Sp\BowerBundle\Composer\ScriptHandler::bowerInstall handling the post-update-cmd event terminated with an exception

[RuntimeException]
An error occurred when executing the "'sp:bower:install'" command.

Sorry for not being able of giving you more information about the cause of the error.

Regards,

David.

Color output issue on Windows

When running bower standalone the colored output is fine in the Command line. But when running sp:bower:install the output is somewhat corrupted, e.g.:

bower ←[32m←[39m                      ←[33mdeprecated←[39m You are using the deprecated component.json file
bower ←[32m←[39m                        ←[31mEINVALID←[39m Something went wrong while reading D:\test\app\cache\dev\sp_bower\component.json

OSX 10.8.5 node no such file or directory on bower list --json

I added the SpBowerBundle to my application and after I clear the cache and I load a controller action, I get the following exception:

Sp\BowerBundle\Bower\Exception\CommandException: Something went wrong while executing the command '/usr/local/share/npm/bin/bower' 'list' '--json' '-V' env: node: No such file or directory...

The exception isn't thrown for any requests after. I'm assuming it has something to do with a cache warmup?

I have check my path for my user and globally and the path to node and bower and they exist:

/usr/local/opt/php53/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/python:/usr/local/share/npm/bin:/usr/local/opt/ruby/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/sbin:/usr/local/share/python:/usr/local/share/npm/bin:/usr/local/opt/ruby/bin

You'll notice that some of it is duplicated because I'm using paths.d solution to add the path to any npm bins and homebrew bins (usr/local/bin) to my global path.

Thoughts?

Dependency with `-` in name generates assetic error

I tried to define a dependency for font-awesome component like this:

{
    "dependencies": {
        "font-awesome": "3.0.x"
    }
}

Then I install components using SpBowerBundle installer and then I run php app/console assetic:dump to dump my assets and I get this error:

[error] The name "font-awesome_css" is invalid.

Looks like - is not removed from the dependency name which makes assetic error.

Incorrect argument type in Bower.php

Catchable Fatal Error: Argument 3 passed to Sp\BowerBundle\Bower\Bower::__construct() must be an instance of Symfony\Component\EventDispatcher\EventDispatcher, instance of Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher given, called in /work/avm/symfony/app/cache/dev/appDevDebugProjectContainer.php on line 4002 and defined in /work/avm/symfony/vendor/sp/bower-bundle/Sp/BowerBundle/Bower/Bower.php line 63

Broken if only js or css

this commit
b2579f3

do

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'There is no "jquery_css" asset.' in /home/ivan/work/editor.my/vendor/kriswallsmith/assetic/src/Assetic/AssetManager.php:37 Stack trace: #0 /home/ivan/work/editor.my/vendor/kriswallsmith/assetic/src/Assetic/Factory/LazyAssetManager.php(180): Assetic\AssetManager->get('jquery_css') #1 /home/ivan/work/editor.my/vendor/kriswallsmith/assetic/src/Assetic/Asset/AssetReference.php(125): Assetic\Factory\LazyAssetManager->get('jquery_css') #2 /home/ivan/work/editor.my/vendor/kriswallsmith/assetic/src/Assetic/Asset/AssetReference.php(83): Assetic\Asset\AssetReference->callAsset('getSourcePath') #3 /home/ivan/work/editor.my/vendor/kriswallsmith/assetic/src/Assetic/Asset/Iterator/AssetCollectionIterator.php(66): Assetic\Asset\AssetReference->getSourcePath() #4 [internal function]: Assetic\Asset\Iterator\AssetCollectionIterator->current() #5 /home/ivan/work/editor.my/vendor/kriswallsmith/assetic/src/Assetic/Factory/AssetFactory.php(382): FilterIterator->rewind() # in /home/ivan/work/editor.my/vendor/symfony/symfony/src/Symfony/Component/Config/Loader/FileLoader.php on line 100

on start
jquery_css not exist

Cache clear creates error

Hi, if I clear the cache I get an error:

[Sp\BowerBundle\Bower\Exception]
Dependency cache keys not yet generated, run "app/console sp:bower:install" to initiate the cache

This seems to be because the entries are not generated before the routes are generated.

Any ideas?

"Dependency cache keys not yet generated"

When I run php app/console assetic:dump in Symfony 2.3.7 I am getting the following error message:

[Sp\BowerBundle\Bower\Exception\RuntimeException]
Dependency cache keys not yet generated, run "app/console sp:bower:install" to initiate the cache: Cached dependencies for "/Users/luebbert/tmp/Symfony/app/cache/dev/sp_bower" not found, c
reate it with the method createDependencyMappingCache().

I did the following to reproduce the problem with a fresh Symfony 2.3.7 project:

  • php composer.phar create-project symfony/framework-standard-edition demo 2.3.*
  • php app/console generate:bundle
  • created AcmeFooBundle
  • followed the install documentation for the spPowerBundle (did not do step 7, as it seems to be optional)

I can upload the demo project if this helps. This issue is not urgent, was mainly playing around with the bundle :-)

Delete cache files will cause error in dev env

Hi,

I'm use symfony 2.1.8.
In the dev env, execute "rm -rf app/cache/*" will cause error.
Without install sp/bower-bundle, this command would remove all cache files, and rebuild during the first request.

RuntimeException: An error occurred while executing the command 'bower' 'list' '--map'. The error was: "sh: bower: command not found"
in /Users/sliver/projects/my/vendor/sp/bower-bundle/Sp/BowerBundle/Bower/Bower.php line 219
at Bower->execCommand(object(Configuration), array('list', '--map')) in /Users/sliver/projects/my/vendor/sp/bower-bundle/Sp/BowerBundle/Bower/Bower.php line 82
at Bower->createDependencyMappingCache(object(Configuration)) in /Users/sliver/projects/my/vendor/sp/bower-bundle/Sp/BowerBundle/CacheWarmer/DependencyCacheWarmer.php line 67
at DependencyCacheWarmer->warmUp('/Users/sliver/projects/my/app/cache/dev') in /Users/sliver/projects/my/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php line 47
at CacheWarmerAggregate->warmUp('/Users/sliver/projects/my/app/cache/dev') in /Users/sliver/projects/my/app/bootstrap.php.cache line 873
at Kernel->initializeContainer() in /Users/sliver/projects/my/app/bootstrap.php.cache line 573
at Kernel->boot() in /Users/sliver/projects/my/app/bootstrap.php.cache line 616
at Kernel->handle(object(Request)) in /Users/sliver/projects/my/web/app_dev.php line 25

Bowerrc placement requires the src/FooBundle/Resources/config/bower directory to be writable by the www-user

The .bowerrc placement requires the src/FooBundle/Resources/config/bower directory to be writable by the www-user.

This is because init() is called on app/console and it automatically tries to overwrite the existing bower config.

Possible fixes:

  1. Add a check so that the bower config is not overwritten if the file content equals the content we wanted to write to it.
  2. Write .bowerrc to the cache dir.

Using only some assets from a bower package

Hi,

What if I want to use some assets from a package?

I'm trying to use this bundle to integrate the wysihtml5 package from bower, but this package does not export a main section so I will have to decide myself which files should be included. Is this outside the scope of the @package_js syntax?

Error: EACCES, mkdir '/var/vendor'

I followed the README, and this was the output when I ran app/console sp:bower:install:

Installing bower dependencies for "ASDAdmBundle" into "/vagrant/vendor/asd/adm-bundle/ASD/AdmBundle/Resources/config/bower/../../public/components"
bower jquery#~2.1               cached git://github.com/jquery/jquery.git#2.1.0
bower jquery#~2.1             validate 2.1.0 against git://github.com/jquery/jquery.git#~2.1
bower                           EACCES EACCES, mkdir '/var/vendor'

Stack trace:
Error: EACCES, mkdir '/var/vendor'

Console trace:
Trace
    at StandardRenderer.error (/usr/lib/node_modules/bower/lib/renderers/StandardRenderer.js:74:17)
    at Logger.<anonymous> (/usr/lib/node_modules/bower/bin/bower:114:22)
    at Logger.EventEmitter.emit (events.js:95:17)
    at Logger.emit (/usr/lib/node_modules/bower/node_modules/bower-logger/lib/Logger.js:29:39)
    at /usr/lib/node_modules/bower/lib/commands/install.js:35:16
    at _rejected (/usr/lib/node_modules/bower/node_modules/q/q.js:797:24)
    at /usr/lib/node_modules/bower/node_modules/q/q.js:823:30
    at Promise.when (/usr/lib/node_modules/bower/node_modules/q/q.js:1035:31)
    at Promise.promise.promiseDispatch (/usr/lib/node_modules/bower/node_modules/q/q.js:741:41)
    at /usr/lib/node_modules/bower/node_modules/q/q.js:557:44

System info:
Bower version: 1.3.1
Node version: 0.10.26
OS: Linux 3.2.0-60-generic x64



  [Sp\BowerBundle\Bower\Exception\RuntimeException]
  An error occured while installing dependencies



sp:bower:install

I ran the command in the root directory. A bundle in the vendor directory (ASDAdmBundle), has the following config file created at ./vendor/asd/adm-bundle/ASD/AdmBundle/Resources/config/bower/bower.json:

{
    "name": "asd-adm-bundle",
    "dependencies": {
        "jquery": "~2.1"
    }
}

install_on_warmup: true not working

Install on warmup not working.
Still need to do sp:bower:install manually

i use: bower version 1.2.7
sp/bower version dev-master (at this time post created)

Duplicate add files by depends

in list i have

@angular_resource_js
  @angular_js
  /home/ivan/work/editor.my/src/Irev/MainBundle/Resources/public/components/angular-resource/angular-resource.js
@angular_js
  /home/ivan/work/editor.my/src/Irev/MainBundle/Resources/public/components/angular/angular.js
@angular_ui_tinymce_js
  @angular_js
  /home/ivan/work/editor.my/src/Irev/MainBundle/Resources/public/components/angular-ui-tinymce/src/tinymce.js

and i need use all of it on one page

    {% javascripts
    '@angular_resource_js'
    '@angular_ui_tinymce_js'
    %}

for this i get files path_1 and path_2 and they two contains angular.

but if use this

    '@IrevMainBundle/Resources/public/components/jquery-ui/ui/jquery.ui.effect-blind.js'
    '@IrevMainBundle/Resources/public/components/jquery-ui/ui/jquery.ui.menu.js'
    '@IrevMainBundle/Resources/public/components/jquery-ui/ui/*.js'

no dup

Command to list all include options

Hi, it would be very usefull if there was an sp:bower:list-includes command that gave a listing of the various includes that are available. Something like:

$ app/console sp:bower:list-includes
Listinging...
JS:
angular-ui: @angular_ui_js -> components/angular-ui/angular-ui.js
angular: @angular_js -> components/angular/index.js
...
CSS:
angular-ui: @angular_ui_css -> components/angular-ui/angular-ui.css

Also, it should give an indication on how to include specific files in the listing, fx..
how do I include 
angular-ui/build/angular-ui.js
?

RuntimeException: '/usr/local/bin/bower' 'list' '--map'

Hi guys,

I get an error after reloading the page /app_dev.php
config.yml

sp_bower:
    bundles:
        CpKickstartBundle: ~

component.json

{
    "name": "kickstart",
    "version": "0.0.1",
    "description": "A kickstart project with symfony2, requirejs, angularjs, grunt, bower and more",
    "dependencies": {
        "angular-scenario": "~1.0.7",
        "angular-ui": "~0.4.0",
        "angular-bootstrap": "~0.5.0",
        "angular": "~1.0.7",
        "bootstrap-ui": "~0.5.0",
        "less": "~1.2.21",
        "angular-mocks": "~1.0.7",
        "modernizr": "~2.6.2",
        "requirejs": "~2.1.8",
        "bootstrap": "~3.0.0"
    }
}

bower -v
1.2.4

node -v
v0.10.16

uname -a
Linux go-server 3.2.0-52-generic-pae #78-Ubuntu SMP Fri Jul 26 16:43:19 UTC 2013 i686 i686 i386 GNU/Linux

Error message
RuntimeException: An error occurred while executing the command '/usr/local/bin/bower' 'list' '--map'. The error was: "node.js:201
TypeError: Object # has no method 'tmpDir'

Error message in detail
https://gist.github.com/tobiasoberrauch/6342159

Is this an known issue?
Cheers Tobias

CommandException: Something went wrong while executing the command '/usr/bin/bower' 'install' env: node: No such file or directory

OSX 10.9 Build 13A603

$ which node
/usr/local/bin/node
$ node -v
v0.10.21
$ which bower
/usr/bin/bower
$ bower --v
1.2.7

config .yml

sp_bower:
    install_on_warmup: true
    bundles:
        MyBundleName: ~

Node installed via nvm. Tried symlinking to make sure paths are ok similar to issue #44. Happens every time cache is cleared.Thanks!

Error: CommandException: Something went wrong while executing the command '/usr/bin/bower' 'install' env: node: No such file or directory

Stacktrace:

in project/vendor/sp/bower-bundle/Sp/BowerBundle/Bower/Bower.php line 217
at Bower->execCommand(object(Configuration), array('install'), null) in project/vendor/sp/bower-bundle/Sp/BowerBundle/Bower/Bower.php line 82
at Bower->install(object(Configuration)) in project/vendor/sp/bower-bundle/Sp/BowerBundle/CacheWarmer/DependencyCacheWarmer.php line 66
at DependencyCacheWarmer->warmUp('project/app/cache/dev') in project/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/CacheWarmer/CacheWarmerAggregate.php line 47
at CacheWarmerAggregate->warmUp('project/app/cache/dev') in project/app/bootstrap.php.cache line 2443
at Kernel->initializeContainer() in project/app/bootstrap.php.cache line 2215
at Kernel->boot() in project/app/bootstrap.php.cache line 2246
at Kernel->handle(object(Request)) in project/web/app_dev.php line 28

[Sp\BowerBundle\Bower\Exception\RuntimeException] Cached dependencies for "/home/dean/durian2/app/cache/dev/sp_bower" not found, create it with the method createDependencyMappingCache().

Hi,

I get this issue while I put symfony cache folder under /dev/shm, if I use original path instead of link to ramdisk, it works good.

[Sp\BowerBundle\Bower\Exception\RuntimeException]
Cached dependencies for "/home/user/symfony/app/cache/dev/sp_bower" not found, create it with the method createDependencyMappingCache().

Feature: More flexible install assets.

Now in bower.json spec:

main

Recommended
Type: String or Array of String

The primary acting files necessary to use your package. 
While Bower does not directly use these files,
 they are listed with the commands bower list --json 
and bower list --paths, so they can be used by build tools.

But it be usefull for clean install.
May be implement feature that use main parameter for install only public assets?

Every time I clean cache I've to download all components

Not sure if I'm doing something wrong but every time that I clean cache I've to run

app/console sp:bower:install --env=…

I now there is an option to do this auto on warm up. But every time runs bower and download everything again and again, only to create a serialized mapping in the cache, but all my components are already downloaded in my bundle.

May be a app/console sp:bower:install --no-download --env=…
or app/console sp:bower:setup --env=… command that only creates the mapping ?

Thanks!

`composer install` failed at `asserts:install web` command after installing SpBowerBundle

if I remove SpBowerBundle from AppKernel, everything works fine again

error message:

Reading ./composer.lock
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. Run update to update them.
Nothing to install or update
Generating autoload files
Clearing the cache for the dev environment with debug true

[InvalidArgumentException]
The target directory "web" does not exist.

assets:install [--symlink] [--relative] [target]

Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets handling the post-install-cmd event terminated with an exception

[RuntimeException]
An error occurred when executing the "'assets:install '''web''''" command.

log:
[2014-01-05 14:22:54] event.DEBUG: Notified event "bower.pre_exec" to listener "Sp\BowerBundle\EventListener\ExecListener::onPreExec". [] {"project_name":"project"}
[2014-01-05 14:22:54] event.DEBUG: Notified event "bower.post_exec" to listener "Sp\BowerBundle\EventListener\CacheCreateListener::onPostExec". [] {"project_name":"project"}

composer.json:

"scripts": {
    "post-install-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
        "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap",
        "Sp\\BowerBundle\\Composer\\ScriptHandler::bowerInstall"
    ],
    "post-update-cmd": [
        "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
        "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
        "Mopa\\Bundle\\BootstrapBundle\\Composer\\ScriptHandler::postInstallSymlinkTwitterBootstrap",
        "Sp\\BowerBundle\\Composer\\ScriptHandler::bowerInstall"
    ]
},

How to reference a jquery-ui theme?

Is there any convention in the registered Assetic resources beyond the main package name like @jquery_ui/themes/flick/jquery_ui_css to use "sub resources"? Or have to use the asset_dir/path/to/sub-resource.ext?

Would be good if the initial docs makes explicit what happens beyond the sexy package aliases ;)

The dependencies are duplicated

component.json

{
    "dependencies": {
        "jquery": "~1.9",
        "typeahead.js": "latest",
        "datatables": "1.9.4"
    }
}

both typeahead and datatables have dependency on jquery

layout.html.twig

    {% javascripts
    '@typeahead_js_js'
    '@datatables_js'
    filter='?yui_js' %}
    <script type="text/javascript" src="{{ asset_url }}"></script>
    {% endjavascripts %}

is compiled into

 <script type="text/javascript" src="/js/1ff0c74_part_1.js"></script>
 <script type="text/javascript" src="/js/1ff0c74_part_2.js"></script>

where both part_1.js and part_2.js contain jquery library, which is followed with the code of the library which is needed. I think this is unnecessary duplication, which in some cases may break the whole page, because some scripts fail if they are executed more than one time.

Also

    {% javascripts
    '@jquery_js'
    '@typeahead_js_js'
    '@datatables_js'
    filter='?yui_js' %}
    <script type="text/javascript" src="{{ asset_url }}"></script>
    {% endjavascripts %}

causes the jQuery lib being included 3 times, whereas it is expected that it is included on explicit @jquery_js call, and not included anymore, even if some other library depends on it.

I have very poor knowledge of Assetic library, is possible to implement this?

P.S. Web asset management and keeping it updated was always a pain in the ass for me. Thanks to bower and this great bundle i believe the issue is almost solved. Many thanks for investing your time in this!

Can this be a sf-composer for assets of a project?

I mean,
I'm new using this bundle but I already like it.

What I wonder is what's the concept to process the assets of the bundles and its dependencies. I would like to know if this bundle scan all the configured sp_bower.bundles first, then it resolves the dependencies and choose the versions that fits for all of them (kinda like composer does), and copies them to an asset_dir (which maybe a global one per project instead per bundle, or not?).

A great job is done in this bundle, kudos,
and you got a big hit here, handling our assets with bower :)
Thanks

Dependency cache gets corrupted somehow

Hi there,

your bundle is great but suddenly since recently I get the following exceptions:

[1/2] ErrorException: Warning: Invalid argument supplied for foreach() in /opt/local/apache2/htdocs/fmdb/vendor/sp/bower-bundle/Sp/BowerBundle/Bower/Bower.php line 116

The affected line loops over the mappings from the cache. When dumping $mapping it is null which isn't supposed to happen I guess. I assume the cache gets corrupted somehow and looses all information about the available packages.

Anything I can do to prevent this?

Symfony 2.2: error while serializing data in ConfigCache with SpBower enabled

Hi,

I am very happy that there is at least one (documented) bundle which integrates Bower into Symfony2.

But after following the installation instructions I got these weird exceptions. I don't know what causes my application to crash.

[1/23] Exception: Serialization of 'Closure' is not allowed:

at SplObjectStorage ->serialize ()
at serialize()
at ConfigCache ->write()

[2/23] Exception: SplObjectStorage::serialize() must return a string or NULL:

at SplObjectStorage ->serialize ()
at serialize()
at ConfigCache ->write()

(etcetera)

Do you have any clue or do you know what may be conflicting with SpBowerBundle?

Tag a stable release

Could you please tag stable release? v0.8 not working with symfony 2.4 (see #45), using @dev not very convenient.

Issue installing bootstrap with bower

Can anybody help me with this?

bower cloning git://github.com/twitter/bootstrap.git
bower cloning git://github.com/components/jquery.git
bower error status code of git: 128
bower cached git://github.com/twitter/bootstrap.git
bower fetching bootstrap
bower fetching jquery
bower cached git://github.com/components/jquery.git
bower checking out jquery#2.0.0
bower warn Package jquery is still using the deprecated "component.json" file
bower copying /Users/drgomesp/.bower/cache/jquery/29cb4373d29144ca260ac7c3997f4381

There were errors, here's a summary of them:
- bootstrap status code of git: 128
fatal: Not a git repository (or any of the parent directories): .git




  [Sp\BowerBundle\Bower\Exception\RuntimeException]                                                                                                                                
  An error occurred while executing the command '/usr/local/bin/bower' 'install'. The error was: "bower warn Package jquery is still using the deprecated "component.js  
  on" file"

sp:bower:install always returns "Bower returned an invalid dependency mapping"

Sorry for flooding you with issues, but I simply can't get it to work. Im on Windows. First of all here's my SpBower config:

sp_bower:
    install_on_warmup: true
    bundles:
        AcmeDemoBundle:
          json_file: bower.json

My bower.json is:

{
    "name": "demo",
    "dependencies": {
        "bootstrap": "~2.3.2"
    }
}

My composer.json looks like (from the standard symfony installation):

{
    [...]
    "require": {
        [...]
        "sp/bower-bundle": "0.8.*@dev"
    },
    "scripts": {
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sp\\BowerBundle\\Composer\\ScriptHandler::bowerInstall"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sp\\BowerBundle\\Composer\\ScriptHandler::bowerInstall"
        ]
    },
    [...]
}

Whenever I echo php app/console sp:bower:install I get the "Bower returned an invalid dependency mapping" message with bower 1.0.0. I already tried deleting the cache folders manually or running php app/console cache:clear and php app/console cache:clear --no-warmup - nothing worked.

I then deleted the components folder and it started to install but also echoed the same warning in the end:

bower bootstrap#~2.3.2      deprecated Package bootstrap is using the deprecated component.json file
bower bootstrap#~2.3.2      not-cached git://github.com/twitter/bootstrap.git#~2.3.2
bower bootstrap#~2.3.2         resolve git://github.com/twitter/bootstrap.git#~2.3.2
bower bootstrap#~2.3.2        download http://github.com/twitter/bootstrap/archive/v2.3.2.tar.gz
bower bootstrap#~2.3.2         extract archive.tar.gz
bower jquery#~1.8.0         deprecated Package jquery is using the deprecated component.json file
bower bootstrap#~2.3.2        resolved git://github.com/twitter/bootstrap.git#2.3.2
bower jquery#~1.8.0         not-cached git://github.com/components/jquery.git#~1.8.0
bower jquery#~1.8.0            resolve git://github.com/components/jquery.git#~1.8.0
bower jquery#~1.8.0           download http://github.com/components/jquery/archive/1.8.3.tar.gz
bower jquery#~1.8.0            extract archive.tar.gz
bower jquery#~1.8.0           resolved git://github.com/components/jquery.git#1.8.3
bower bootstrap#~2.3.2         install bootstrap#2.3.2
bower jquery#~1.8.0            install jquery#1.8.3

bootstrap#2.3.2 ..\..\..\..\src\Headwork\TwentyYearsBundle\Resources\public\components\bootstrap
ÔööÔöÇÔöÇ jquery#1.8.3

jquery#1.8.3 ..\..\..\..\src\Headwork\TwentyYearsBundle\Resources\public\components\jquery



  [Sp\BowerBundle\Bower\Exception\InvalidMappingException]
  Bower returned an invalid dependency mapping. This mostly happens when the dependencies are not yet installed or if you are using an old version of bower.

Using semver versionning pattern

Hi folks,

I used the spBowerBundle, and i recently encountered an error, after looking in the issues list, i have found the exact answer to my problem (#79)
But, unfortunately, a composer update on the spBowerBundle doesnt correct the error on my project.

After a quick search, i discover that you haven't tagged the code from 4 months, 7 commits and, unfortunately, the commit who corrects my problem.

As i think it's not good to include a composer dependancies using "dev-master" (or other "*-master"), i am looking for a clear versionning pattern who allow me to get new code quickly. I personaly use semver.

I really think your project is a really good idea, a good implementation, and i think you should follow a clear versionning pattern to improve it usability for professionnals projects.

Do you think it's possible to add this feature to your project ?

PS : i'm not an original english speaker, and my english is probably a little vague

mustache.js

I've been using the SpBowerBundle and I love it for being able to use bower easier. Thanks!

For some reason when I try to add 'mustache', it doesn't show up as an available asset when I run 'app/console sp:bower:list'. (of course this is after I ran sp:bower:install and see the mustache lib in the proper resources directory)

From bower.json :

"dependencies": {
"mustache" : "master",
"underscore" : "master"
}

Any thoughts?

Thanks again!

Bower commands executed in not related tasks

Why bower is executed in other tasks that are no related at all ?

It happens randomly… (probably) cached related.

I know that the problem in the screenshot it's because I haven't setup my public key … I did that on purpose to show that SpBowerBundle runs commands in other tasks.

bower-command

Bower - Root project configuration

Hi,

While looking at your bundle in order to use it, I am facing the issue about ressources not being in bundles, but in web/assets/vendors.
Thus, I can't really specify a bundle in the config, as my .bowerrc and bower.json files are in the root project.

Does is seem legit to you?

Would be happy to contribute if we agree on the best way to proceed :)

Cached dependencies for $file not found, create it with the method createDependencyMappingCache().

Hi,

When I run app/console cache:clear, I get:

[Sp\BowerBundle\Bower\Exception\RuntimeException]
[exec] Cached dependencies for "/var/lib/jenkins/jobs/TestUndervisningflate/workspace/app/cache/tes_/sp_bower" not found, create it with the method createDependencyMappingCache().
[exec]

I got the following bower config:

sp_bower:
    bin: %kernel.root_dir%/Resources/node_modules/.bin/bower
    install_on_warmup: true
    assetic: ~
    bundles:
        MyBundle: ~

also in composer I got:

dependency: "sp/bower-bundle": "*"


 "scripts": {
        "post-install-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sp\\BowerBundle\\Composer\\ScriptHandler::bowerInstall"
        ],
        "post-update-cmd": [
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sp\\BowerBundle\\Composer\\ScriptHandler::bowerInstall"
        ]
    },

default bower config file should move from component.json to bower.json

I know, there have been already some (closed) tickets on that, but with the todays release of bower 1.0.0 it throws a error:

bower - You are using the deprecated component.json file

This can be workaround by configuring the default file name now but for future releases the standard name SpBowerBundle uses should be bower.json.

Bootstrap3 and glyphicons

Do i have to config the font path for the glyphicons? or is there a special way to get the glyphicons? they come with bootstrap3 and are installed in src/Sandbox/Bundle/MainBundle/Resources/public/components/bootstrap/dist/fonts. but they are not shown in my browser.

Issues with component.json

We are having some issues with installing the deps from an older project:

vagrant@precise64:/vagrant$ app/console sp:bower:install 

  [Sp\BowerBundle\Bower\Exception\RuntimeException]                                                                                                                                        
  An error occurred while executing the command '/usr/local/bin/bower' 'install'. The error was: "bower warn Package jquery is still using the deprecated "component.json" file  
  bower warn Package bootstrap-datepicker is still using the deprecated "component.json" file                                                                                    
  bower warn Package bootstrap is still using the deprecated "component.json" file                                                                                               
  bower warn Package jquery is still using the deprecated "component.json" file                                                                                                  
  bower warn Package jquery is still using the deprecated "component.json" file                                                                                                  
  bower warn Package bootstrap is still using the deprecated "component.json" file                                                                                               
  bower warn Package jquery is still using the deprecated "component.json" file                                                                                                  
  bower warn Package jquery is still using the deprecated "component.json" file"  

As I understand, bower moved from component.json to bower.json.

Do you know how to resolved this issue?

Thanks.

Cache warmup is slow

Hi there, I really like the way this bundle eases the integration of bower with Symfony2, but I find it slow when the cache warms up in the dev environment. It takes around 7.5 seconds to warm the cache (according to the profiler) or 4.5 seconds with assetic and install_on_warmup to false while without the bundle it takes me 2.5 seconds from a cleared dev cache. Am I doing something wrong? My current configuration is as follow:

sp_bower:
    bin: %kernel.root_dir%/../node_modules/.bin/bower
    install_on_warmup: true
    assetic:
        nest_dependencies:
            jquery-ui: false
    bundles:
        App:
            asset_dir: ../../public/components

Even with these configurations disabled it is slow

assetic: false
install_on_warmup: false

config_dev.yml:

assetic:
    use_controller: false

because it still needs to create the entire dependency cache

my bower.json:

{
    "name": "ftq",
    "dependencies": {
        "html5shiv": "3.7.0",
        "jquery": "1.8.3",
        "jquery-ui": "1.8.23",
        "bootstrap": "2.3.2"
    },
    "devDependencies": {
        "sinon": "1.7.3",
        "jasmine": "1.3.1",
        "jasmine-jquery": "1.5.9",
        "jasmine-sinon": "0.1.0",
        "karma-jasmine": "0.1.3"
    }
}

Isn't there a way to recreate the dependency mapping when it actually really needs a refresh? Because changing a single parameter information in a config file will recreate the entire dependency map

"An exception has been thrown during the compilation of a template ("There is no "uglify2js" filter.")

Hi, I have this configuration:

sp_bower:
    bin: %kernel.root_dir%/Resources/node_modules/.bin/bower
    install_on_warmup: true
    assetic:
        enabled: true
        nest_dependencies: true
        filters:
            css:
                - ?uglifycss
            js:
                - "?uglify2js"
            packages:
                bootstrap:
                    css:
                        - cssrewrite
                    js:
                        - ?uglify2js
    bundles:
        MyBundle: ~

assetic:
    debug:          %kernel.debug%
    use_controller: false
    filters:
        uglifyjs2:
            bin: %kernel.root_dir%/Resources/node_modules/.bin/uglifyjs
        uglifycss:
            bin: %kernel.root_dir%/Resources/node_modules/.bin/uglifycss

a template with a javascripts section like this:

{% javascripts filter="?uglifyjs2"
...
@myBowerBundle_js
...

This works in my dev and prod environments, but when I run my tests I get the error:

Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the compilation of a template ("There is no "uglify2js" filter.") in 

Is this a known problem or should this work?

Empty assets for some packages

For some of my defined packages I get only empty assets when I specify them, e.g. for "font-awesome": "~4.0".

The output of sp:bower:list for this package is the following:

@font_awesome_css
  ~
@font_awesome_js
  ~

It looks to me that the correct files cannot be found resulting in an empty asset when specified. Is this true?

RuntimeException while clearing cache

Is there a problem moving the cache files to app/cache?
It should't huh? because they are not deleted with cache:clear.

I'm using a config.yml section like this:

sp_bower:
    bundles:
        SonataAdminBundle:
            asset_dir: %kernel.root_dir%/../web/vendor/
            cache:
                %kernel.cache_dir%/../sp_bower/SonataAdminBundle

So, sp:bower:install runs smoothly but creates an app/cache/de_ folder, and if I try to clear the cache I get this:

Dependency cache keys not yet generated, run "app/console sp:bower:install" to initiate the cache: Cached dependencies for "/path/to/my/app/ca  
  che/de_/sp_bower" not found, create it with the method createDependencyMappingCache(). 

The de_ environment?
Thanks in advice

Not compatible with Netbeans

Breaks the symfony command-line console after registering the bundle.

Shows:

<There is no command available (perhaps error?)>

when attempting to run commands from the command-line console

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.