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 a bundle script to generate a zip file for theme distribution #1417

Merged
merged 3 commits into from
Apr 30, 2020
Merged

Add a bundle script to generate a zip file for theme distribution #1417

merged 3 commits into from
Apr 30, 2020

Conversation

Ismail-elkorchi
Copy link
Contributor

@Ismail-elkorchi Ismail-elkorchi commented Apr 26, 2020

Changes proposed in this Pull Request:

This PR adds a NodeJS script to generate a zip file for theme distribution, while excluding development and system files.

Testing instructions:

To test this PR run npm run bundle in command line. A zip file containing only the essential theme files should be created in the parent directory of the actual theme. Note that the name of the zip file name should be the same as the theme directory name.

@neilabraham
Copy link
Contributor

Would it be better to output a zip file instead of a directory?

@Ismail-elkorchi
Copy link
Contributor Author

Would it be better to output a zip file instead of a directory?

Definitely, that would be ideal. The problem is that Node.js doesn’t support the full .zip format, and I can't find a way to make this work without relying on an external NPM module.

@neilabraham
Copy link
Contributor

Having as few npm dependencies as possible was a goal expressed in #1149 in 2017. Maybe it's time to re-examine that decision. I'm in favour of adding new dependencies where useful. I'd quite like to add npm-run-all and nodemon myself.

@Ismail-elkorchi
Copy link
Contributor Author

I updated this PR to output a zip file instead of a directory using archiver. I have tested the command on macOS, and it works without any side effects. Could you please test it on a windows machine, if you have any?

I agree with you that we shouldn't be limited to a fixed number of dependencies if these turn out to be useful. I think that we could add some needed functionality, like SASS watcher, browser-sync and maybe wp-env, while keeping a reasonable number of dependencies.

Feel free to open an issue if you want to discuss this issue further.

@Ismail-elkorchi Ismail-elkorchi changed the title Add a bundle script to bundle the theme for production Add a bundle script to to generate a zip file for theme distribution Apr 29, 2020
@Ismail-elkorchi Ismail-elkorchi changed the title Add a bundle script to to generate a zip file for theme distribution Add a bundle script to generate a zip file for theme distribution Apr 30, 2020
@Ismail-elkorchi Ismail-elkorchi merged commit dfd1dd9 into Automattic:master Apr 30, 2020
@Ismail-elkorchi Ismail-elkorchi deleted the bundle branch April 30, 2020 20:16
dsgreen added a commit to dsgreen/_s that referenced this pull request Sep 9, 2020
* 'master' of https://github.com/Automattic/_s: (92 commits)
  Remove PHPCS Ignore Around $content-width (Automattic#1450)
  Use _S_VERSION constant when enqueuing customizer.js (Automattic#1445)
  Update composer and node dependencies (Automattic#1444)
  Add missing s in languages directory name (Automattic#1442)
  Exclude alignment classes from RTL conversion (Automattic#1435)
  Add new required header fields for style.css (Automattic#1432)
  Remove redundant font-size declarations (Automattic#1434)
  Refactor navigation.js to Javascript ES6 (Automattic#1423)
  Delete the custom bundle script in favor of an npm package (Automattic#1433)
  Fix small typo (Automattic#1428)
  Re-organize SASS structure (Automattic#1425)
  Add a SASS watcher command (Automattic#1427)
  Remove the skip link focus fix (Automattic#1424)
  Replace className.indexOf with classList.contains (Automattic#1422)
  Use CSS grid for gallery styles (Automattic#1246)
  Update README.md documentation (Automattic#1419)
  Add a bundle script to generate a zip file for theme distribution (Automattic#1417)
  Update npm dependencies (Automattic#1418)
  Float implies the use of the block layout (Automattic#960)
  Use the system font stack from WP admin (Automattic#1416)
  ...
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