Automattic / _s

Hi. I'm a starter theme called _s, or underscores, if you like. I'm a theme meant for hacking so don't use me as a Parent Theme. Instead try turning me into the next, most awesome, WordPress theme out there. That's what I'm here for.
http://underscores.me/
GNU General Public License v2.0
10.93k stars 3.12k forks source link

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

Closed Ismail-elkorchi closed 4 years ago

Ismail-elkorchi commented 4 years ago

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 commented 4 years ago

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

Ismail-elkorchi commented 4 years ago

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 commented 4 years ago

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 commented 4 years ago

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.