-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Estilos de la aplicación #14
Comments
Hola neozoe, Lo de los estilos es normal, porque esta es la forma de trabajar con Symfony2. Para solucionarlo, tienes que ejecutar la instrucción número 5 de la guía de uso: Genera los web assets con Assetic: Sobre el rendimiento no sabría que decirte, porque no conozco tu instalación. Lo que sí que te puedo decir es que en mi modesto portátil de hace 2 años consigo generar 300 portadas completas por segundo, gracias a la cache de HTTP y ESI. |
La instalación es sobre un xampplite 1.7.7 (Apache 2.2.21, MySQL 5.5.16, PHP 5.3.8, phpMyAdmin 3.4.5) Me da éste mensaje de error, cuando lo ejecuto para
|
tengo el mismo error que neozoe con el xampp full instalado. felices fiestas |
se que no les ayudara mucho, pero la solución es usar linux ;) |
BUAAAAAaaaaaaaaaaaaaaaaaaaaaa |
Sigo sin entender qué es lo que hace Xampp Lite para que Assetic no funcione como debería. En cualquier caso, si ves el código fuente del archivo <?php
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
namespace Symfony\Bundle\AsseticBundle\Command;
use Assetic\Asset\AssetInterface;
use Assetic\Factory\LazyAssetManager;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
/**
* Dumps assets to the filesystem.
*
* @author Kris Wallsmith <kris@symfony.com>
*/
class DumpCommand extends ContainerAwareCommand
{
private $basePath;
private $verbose;
private $am;
protected function configure()
{
$this
->setName('assetic:dump')
->setDescription('Dumps all assets to the filesystem')
->addArgument('write_to', InputArgument::OPTIONAL, 'Override the configured asset root')
->addOption('watch', null, InputOption::VALUE_NONE, 'Check for changes every second, debug mode only')
->addOption('force', null, InputOption::VALUE_NONE, 'Force an initial generation of all assets (used with --watch)')
->addOption('period', null, InputOption::VALUE_REQUIRED, 'Set the polling period in seconds (used with --watch)', 1)
;
}
protected function initialize(InputInterface $input, OutputInterface $output)
{
parent::initialize($input, $output);
$this->basePath = $input->getArgument('write_to') ?: $this->getContainer()->getParameter('assetic.write_to');
$this->verbose = $input->getOption('verbose');
$this->am = $this->getContainer()->get('assetic.asset_manager');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$output->writeln(sprintf('Dumping all <comment>%s</comment> assets.', $input->getOption('env')));
$output->writeln(sprintf('Debug mode is <comment>%s</comment>.', $input->getOption('no-debug') ? 'off' : 'on'));
$output->writeln('');
if (!$input->getOption('watch')) {
foreach ($this->am->getNames() as $name) {
$this->dumpAsset($name, $output);
}
return;
}
if (!$this->am->isDebug()) {
throw new \RuntimeException('The --watch option is only available in debug mode.');
}
$this->watch($input, $output);
}
// ...
/**
* Performs the asset dump.
*
* @param AssetInterface $asset An asset
* @param OutputInterface $output The command output
*
* @throws RuntimeException If there is a problem writing the asset
*/
private function doDump(AssetInterface $asset, OutputInterface $output)
{
$target = rtrim($this->basePath, '/').'/'.str_replace('_controller/', '', $asset->getTargetPath());
if (!is_dir($dir = dirname($target))) {
$output->writeln('<info>[dir+]</info> '.$dir);
if (false === @mkdir($dir, 0777, true)) {
throw new \RuntimeException('Unable to create directory '.$dir);
}
}
$output->writeln('<info>[file+]</info> '.$target);
if ($this->verbose) {
if ($asset instanceof \Traversable) {
foreach ($asset as $leaf) {
$root = $leaf->getSourceRoot();
$path = $leaf->getSourcePath();
$output->writeln(sprintf(' <comment>%s/%s</comment>', $root ?: '[unknown root]', $path ?: '[unknown path]'));
}
} else {
$root = $asset->getSourceRoot();
$path = $asset->getSourcePath();
$output->writeln(sprintf(' <comment>%s/%s</comment>', $root ?: '[unknown root]', $path ?: '[unknown path]'));
}
}
if (false === @file_put_contents($target, $asset->dump())) {
throw new \RuntimeException('Unable to write file '.$target);
}
}
} La línea Si puedes, añade algún |
Hola, A mi me pasa lo mismo en Windows(Wamp Server). |
@tacheshun ¿ has probado lo que se comenta en #14 (comment) ? |
Hola Javier: bajé la aplicación y la ubicación sería sin "/blob/master" |
@mprizmic en el libro se indica lo siguiente: "[...] añade los siguientes archivos y copia los estilos de los archivos que se indican [...]":
Primero se indica el nombre del archivo de la aplicación (que como bien dices, no incluye |
El problema está en el parametro $asset->dump(). Porque si creo una variable, que contenga un texto cualquiera, y lo reemplazo por $asset->dump(). Se generan todos los archivos dentro de web/css y web/js. (Obviamente todos los archivos tienen como contenido el string asignado a la variable....) $actual = "Contenido"; if (false === @file_put_contents($target, $actual)) { throw new \RuntimeException('Unable to write file '.$target); } Habria que ver porque $asset->dump() no esta funcionando en Windows 7 + IIS7 + PHP 5.3.8 Nota: Nunca se llega a lanzar la excepcion new \RuntimeException('Unable to write file '.$target). El error que sale es [RuntimeException] |
Bueno, por suerte ya pude solucionar el problema. Aparentemente es un problema que afecta a Windows. Buscando un poco por stackoverlflow me encontre con el siguiente hilo. http://stackoverflow.com/questions/8195114/symfony2-assetics-yui-compressor-on-windows-path-syntax Si siguen los pasos de Boo (Nov 19 '11 at 22:53), ya van a poder generar los archivos css y js. Y ver la aplicacion Cupon sin problemas. A mi especificamente el archivo config.yml en la seccion assetic me quedo asi: assetic: debug: %kernel.debug% use_controller: false java: C:\Program Files (x86)\Java\jre7\bin\java.exe filters: cssrewrite: ~ yui_css: jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.6.jar apply_to: \.css$ yui_js: jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.6.jar apply_to: \.js$ Luego modifiquen el metodo getProcess dentro del archivo \vendor\assetic\src\Assetic\Util\ProcessBuilder.php (Tal como dice bob en stackoverflow) public function getProcess() { if (!count($this->arguments)) { throw new \LogicException('You must add() command arguments before calling getProcess().'); } $options = $this->options; //Modificar if (defined('PHP_WINDOWS_VERSION_MAJOR')) { $options += array('bypass_shell' => true); $args = $this->arguments; $cmd = array_shift($args); $script = '"'.$cmd.'"'; if ($args) { //Modificar $script .= ' '.implode(' ', array_map('escapeshellarg', $args)); } } else { $script = implode(' ', array_map('escapeshellarg', $this->arguments)); } $env = $this->inheritEnv ? ($this->env ?: array()) + $_ENV : $this->env; //Modificar return new Process($script, $this->cwd, null, $this->stdin, $this->timeout, $options); } |
Hola Javier,
Estoy probando tu aplicación, y he visto en el directorio de ficheros que la carpeta css está vacía. No aparece ningún estilo y al navegar por la aplicación, evidentemente aparece totalmente plana, con texto...
Una vez levantados los servicios de Apache y MySQL... accedo a la aplicación, pero haciendo click en oferta del día, o mi perfil, no termina de cargar la siguiente página... va lento....
Gracias de antemano por tu ayuda...
The text was updated successfully, but these errors were encountered: