Add option to remove Bootstrap when creating project (#1810)

* Add option to remove Bootstrap when creating project
* Remove phpmd, per @QWp6t
This commit is contained in:
Ben Word
2017-01-14 19:56:17 -07:00
committed by GitHub
parent ea7323a5ae
commit b91ab89834
3 changed files with 44 additions and 290 deletions

View File

@@ -0,0 +1,28 @@
<?php
namespace Roots\Sage;
use Composer\Script\Event;
class PostCreateProject
{
public static function removeBootstrap(Event $event)
{
$io = $event->getIO();
// @codingStandardsIgnoreStart
if ($io->isInteractive()) {
if ($io->askConfirmation('<info>Remove Bootstrap?</info> [<comment>y,N</comment>]? ', false)) {
file_put_contents('package.json', str_replace(' "bootstrap": "^4.0.0-alpha.6",' . "\n", '', file_get_contents('package.json')));
file_put_contents('assets/styles/main.scss', str_replace('// Import npm dependencies' . "\n", '', file_get_contents('assets/styles/main.scss')));
file_put_contents('assets/styles/main.scss', str_replace('@import "~bootstrap/scss/bootstrap";' . "\n", '', file_get_contents('assets/styles/main.scss')));
file_put_contents('assets/scripts/main.js', str_replace('import \'bootstrap/dist/js/bootstrap\';' . "\n", '', file_get_contents('assets/scripts/main.js')));
file_put_contents('assets/styles/components/_comments.scss', '');
file_put_contents('assets/styles/components/_forms.scss', '');
file_put_contents('assets/styles/components/_wp-classes.scss', '');
file_put_contents('assets/styles/layouts/_header.scss', '');
}
}
// @codingStandardsIgnoreEnd
}
}