Add option to add Font Awesome
This commit is contained in:
@@ -42,7 +42,6 @@ class PostCreateProject
|
||||
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', '');
|
||||
@@ -52,5 +51,24 @@ class PostCreateProject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function addFontAwesome(Event $event)
|
||||
{
|
||||
$io = $event->getIO();
|
||||
|
||||
if ($io->isInteractive()) {
|
||||
if ($io->askConfirmation('<info>Add Font Awesome?</info> [<comment>y,N</comment>]? ', false)) {
|
||||
$package = json_decode(file_get_contents('package.json'), true);
|
||||
$dependencies = $package['dependencies'];
|
||||
$dependencies = array_merge($dependencies, ['font-awesome' => '^4.7.0']);
|
||||
$package['dependencies'] = $dependencies;
|
||||
$package = str_replace(' ', ' ', json_encode($package, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n");
|
||||
|
||||
$import_dep_str = '// Import npm dependencies' . "\n";
|
||||
file_put_contents('assets/styles/main.scss', str_replace($import_dep_str, $import_dep_str . '@import "~font-awesome/scss/font-awesome";' . "\n", file_get_contents('assets/styles/main.scss')));
|
||||
file_put_contents('assets/styles/common/_variables.scss', "\n" . '$fa-font-path: \'~font-awesome/fonts\';' . "\n", FILE_APPEND);
|
||||
}
|
||||
}
|
||||
}
|
||||
// @codingStandardsIgnoreEnd
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user