Skip to content

Commit

Permalink
Add Spectre.css as a CSS Framework option during install
Browse files Browse the repository at this point in the history
  • Loading branch information
atanas-dev committed Nov 30, 2018
1 parent dd5072f commit d51abdf
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Commands/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ protected function shouldInstallCssFramework( InputInterface $input, OutputInter

$question = new ChoiceQuestion(
'Please select a CSS framework:',
['None', 'Normalize.css', 'Bootstrap', 'Bulma', 'Foundation', 'Tachyons', 'Tailwind CSS'],
['None', 'Normalize.css', 'Bootstrap', 'Bulma', 'Foundation', 'Tachyons', 'Tailwind CSS', 'Spectre.css'],
0
);

Expand Down
5 changes: 5 additions & 0 deletions src/Commands/InstallCssFramework.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use WPEmerge\Cli\Presets\Bulma;
use WPEmerge\Cli\Presets\Foundation;
use WPEmerge\Cli\Presets\NormalizeCss;
use WPEmerge\Cli\Presets\Spectre;
use WPEmerge\Cli\Presets\Tachyons;
use WPEmerge\Cli\Presets\TailwindCss;

Expand Down Expand Up @@ -63,6 +64,10 @@ protected function execute( InputInterface $input, OutputInterface $output ) {
$preset = new TailwindCss();
break;

case 'Spectre.css':
$preset = new Spectre();
break;

default:
throw new RuntimeException( 'Unknown css framework selected: ' . $css_framework );
break;
Expand Down
28 changes: 28 additions & 0 deletions src/Presets/Spectre.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace WPEmerge\Cli\Presets;

use Symfony\Component\Console\Output\OutputInterface;

class Spectre implements PresetInterface {
use FrontEndPresetTrait;

/**
* {@inheritDoc}
*/
public function getName() {
return 'Spectre.css';
}

/**
* {@inheritDoc}
*/
public function execute( $directory, OutputInterface $output ) {
$this->installNodePackage( $directory, $output, 'spectre.css', '^0.5.7' );

$this->copy([
$this->path( WPEMERGE_CLI_DIR, 'src', 'Spectre', 'spectre.js' )
=> $this->path( $directory, 'resources', 'scripts', 'theme', 'vendor', 'spectre.js' ),
]);
}
}
4 changes: 4 additions & 0 deletions src/Spectre/spectre.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/* ------------------------------------------------------------ *\
This is an automatically generated file - do not edit.
\* ------------------------------------------------------------ */
import 'spectre.css/dist/spectre.min.css';

0 comments on commit d51abdf

Please sign in to comment.