Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Copy images #9

Merged
merged 2 commits into from

3 participants

Andrew Tch Julien 'ruian' Galenski Adrien Delorme
Andrew Tch

Some minor code fixes and simple copy of images to img/folder; I, though, think of fixing #8 and returning to this along with changing paths to bootstrap/img/v2 which requires changing @iconSpritePath and @iconWhiteSpritePath variables.

Julien 'ruian' Galenski ruian merged commit 830a30d into from
Julien 'ruian' Galenski
Owner

Thx @andrewtch ;-)

Adrien Delorme
azr commented

Nice !

But you need to ignore the images or make the clean command to remove them because it stops the vendor script from finishing :

"RuianTwitterBootstrapBundle" has local modifications. Please revert or commit/push them before running this command again.
Andrew Tch andrewtch referenced this pull request
Merged

Dir check and ignore files #10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 23, 2012
  1. Andrew Tch

    Code cleanup

    andrewtch authored
  2. Andrew Tch

    copy images

    andrewtch authored
This page is out of date. Refresh to see the latest.
33 Command/CompilerCommand.php
View
@@ -14,9 +14,9 @@ class CompilerCommand extends ContainerAwareCommand
{
protected $versions;
- public function __construct()
+ public function __construct($name = null)
{
- parent::__construct($name = null);
+ parent::__construct($name);
$this->versions = array(
'v1',
'v2'
@@ -35,6 +35,7 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
$version = $input->getArgument('version');
+
if (false === in_array($version, $this->versions)) {
throw new TwitterBootstrapVersionException("Version you have selected is not supported, or inexistant. Please choose one of these versions " . implode(' or ', $this->versions));
}
@@ -46,6 +47,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
if (true === $this->writeJs($version, $output)) {
$output->writeln('<info>Success, bootstrap'.$version.'.js has been written in /Ruian/TwitterBootstrapBundle/Resources/public/js/bootstrap'.$version.'.js</info>');
}
+
+ if (true === $this->copyImages($version, $output)) {
+ $output->writeln('<info>Success, bootstrap'.$version.' images have been copied to /Ruian/TwitterBootstrapBundle/Resources/public/img</info>');
+ }
}
protected function writeCss($version, $output)
@@ -53,7 +58,9 @@ protected function writeCss($version, $output)
if ('v1' === $version) {
$in = __DIR__ . '/../../../../twitter/bootstrap/'.$version.'/lib/bootstrap.less';
$out = __DIR__ . '/../Resources/public/css/bootstrap' . $version . '.css';
+
lessc::ccompile($in, $out);
+
$output->writeln('<comment>Writing bootstrap'.$version.'.css from bootstrap.less</comment>');
$output->writeln('<comment>You can add bundles/ruiantwitterbootstrap/css/bootstrap'.$version.'.css to your layout</comment>');
}
@@ -61,17 +68,33 @@ protected function writeCss($version, $output)
if ('v2' === $version) {
$in = __DIR__ . '/../../../../twitter/bootstrap/'.$version.'/less/bootstrap.less';
$out = __DIR__ . '/../Resources/public/css/bootstrap' . $version . '.css';
+
lessc::ccompile($in, $out);
+
$output->writeln('<comment>Writing bootstrap'.$version.'.css from bootstrap.less</comment>');
$output->writeln('<comment>You can add bundles/ruiantwitterbootstrap/css/bootstrap'.$version.'.css to your layout</comment>');
$in = __DIR__ . '/../../../../twitter/bootstrap/'.$version.'/less/responsive.less';
$out = __DIR__ . '/../Resources/public/css/bootstrap' . $version . '-responsive.css';
+
lessc::ccompile($in, $out);
+
$output->writeln('<comment>Writing bootstrap'.$version.'-responsive.css from responsive.less</comment>');
$output->writeln('<comment>You can add bundles/ruiantwitterbootstrap/css/bootstrap'.$version.'-responsive.css to your layout</comment>');
}
-
+
+ return true;
+ }
+
+ protected function copyImages($version, $output) {
+ //no images to copy for 1.x bootstrap
+
+ if ('v2' === $version) {
+ foreach (glob(__DIR__ . '/../../../../twitter/bootstrap/'.$version.'/img/*') as $image) {
+ copy($image, __DIR__ . '/../Resources/public/img/' . basename($image));
+ }
+ }
+
return true;
}
@@ -106,13 +129,17 @@ protected function writeJs($version, $output)
}
$bootstrapjs = null;
+
foreach ($files as $file) {
$bootstrapjs .= file_get_contents(realpath($jsDir . $file));
$output->writeln('<comment>Adding '.$file.'</comment>');
}
+
file_put_contents(__DIR__ . '/../Resources/public/js/bootstrap'.$version.'.js', $bootstrapjs);
+
$output->writeln('<comment>Writing bootstrap'.$version.'.js</comment>');
$output->writeln('<comment>You can add bundles/ruiantwitterbootstrap/js/bootstrap'.$version.'.js to your layout</comment>');
+
return true;
}
}
0  Resources/public/img/.keep
View
No changes.
Something went wrong with that request. Please try again.