Skip to content
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

Merged
merged 5 commits into from
Jan 18, 2017

Conversation

retlehs
Copy link
Member

@retlehs retlehs commented Jan 17, 2017

👋

image

@retlehs retlehs force-pushed the option-to-select-css-framework branch from 827b922 to cb06874 Compare January 17, 2017 23:39
@retlehs retlehs force-pushed the option-to-select-css-framework branch from 4a41355 to 03a329e Compare January 18, 2017 00:01
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')));
Copy link
Member

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', '');
Copy link
Member

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, '');
}

@retlehs retlehs merged commit 3909bf7 into beta2 Jan 18, 2017
@retlehs retlehs deleted the option-to-select-css-framework branch January 18, 2017 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants