Gestire librerie di frontend in php
-
Upload
massimiliano-arione -
Category
Technology
-
view
1.975 -
download
0
description
Transcript of Gestire librerie di frontend in php
gestire le librerie di frontend
in PHP!
Massimiliano Arione
voglio gestire le mie librerie di frontend
problema
voglio gestire le mie librerie di frontend
ovvero...
problema
voglio gestire le mie librerie di frontend
ovvero…
file javascriptfogli di stile
problema
librerie esterne!
● bootstrap ● foundation● modernizr● jquery● jquery-ui● font awesome● ecc ecc….
qui parliamo di...
(brutta! NON FATELO!!)
… scaricare le librerie e includere nel repository del progetto
la prima soluzione...
usare composerhttps://github.com/components{
"require": {
"components/modernizr": "2.*",
"components/jqueryui": "1.10.*",
"components/bootstrap": "2.*"
}
}
una prima soluzione decente...
i file sono copiati in una cartella pubblica{
"config": {
"bin-dir": "bin",
"component-dir": "web/components"
},
}
smell
bower!
sudo npm install -g bower
bower helpbower init
seconda soluzione
bower.json{
"name": "PUG Roma",
"authors": [
"Massimiliano Arione”
]
"dependencies": {
"jquery": "2.*"
}
}
file di configurazione
bower install
installazione
.bowerrc
{
"directory": "app/Resources/bower"
}
da aggiungere a .gitignore
con Symfony2
before 'symfony:cache:warmup', 'bower:install'
namespace :bower do desc '[internal] Run the bower install' task :install do invoke_command "cd #{latest_release} && bower:install" endend
capifony
assetic:
assets:
jquery_js:
inputs:
- "%kernel.root_dir%/../app/Resources/bower/jquery/jquery.js"
assetic
{% javascripts
'@jquery_js'
'@AcmeBundle/Resources/public/js/my.js'
%}
layout
?
http://bower.io/https://github.com/Spea/SpBowerBundle