-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Add option to select CSS framework, add Foundation as an option #1813
Conversation
827b922
to
cb06874
Compare
4a41355
to
03a329e
Compare
case 0: | ||
break; | ||
case 1: | ||
file_put_contents('package.json', str_replace(' "bootstrap": "^4.0.0-alpha.6",' . "\n", ' "foundation-sites": "6.3.0",' . "\n", file_get_contents('package.json'))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should turn this into a preg_replace
to so we aren't specific versions in here as much as possible.
Something like:
$default_framework_pattern = '/"bootstrap": ".*"/';
file_put_contents('package.json', preg_replace($default_framework_pattern, '"foundation-sites": "6.3.0"', file_get_contents('package.json')));
Also notice that this eliminates specifying whitespace
file_put_contents('package.json', str_replace(' "bootstrap": "^4.0.0-alpha.6",' . "\n", ' "foundation-sites": "6.3.0",' . "\n", file_get_contents('package.json'))); | ||
file_put_contents('assets/styles/main.scss', str_replace('@import "~bootstrap/scss/bootstrap";' . "\n", '@import "~foundation-sites/scss/foundation";' . "\n" . '@include foundation-everything;' . "\n", file_get_contents('assets/styles/main.scss'))); | ||
file_put_contents('assets/scripts/main.js', str_replace('import \'bootstrap/dist/js/bootstrap\';' . "\n", 'import \'foundation-sites/dist/js/foundation\';' . "\n", file_get_contents('assets/scripts/main.js'))); | ||
file_put_contents('assets/styles/components/_comments.scss', ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe just have an array of file names to clear?
$files_to_clear = [
'assets/styles/components/_comments.scss',
'assets/styles/components/_forms.scss',
'assets/styles/components/_wp-classes.scss',
'assets/styles/layouts/_header.scss',
];
// etc
foreach($files_to_clear as $file) {
file_put_contents($file, '');
}
👋