Temporary workflow - one step at a time (gulp --production)

Hi guys,

My first Sage project is ready. It’s been an interesting journey… :slightly_smiling:
I am developing locally with MAMP as I am still learning and experimenting with Git, Trellis & Bedrock.

There’s just a few things that are not 100% clear to me and need some clarification please.
As I said, my project is ready in Dev, I haven’t ran gulp --production as I am not sure what will happen… I know gulp --production will generate the production assets but I’m scared! :scream: :slightly_smiling:

  1. I would like to save a copy of my project in a private Git repo as it might be a good base for a new project later. Should I do this before creating the production assests (gulp --production) or after?
    I want to be able to start a new project at any time with the same files I have now in MAMP.

  2. So, running gulp --production will generate production assets. The asset filenames will automatically change due to revisioning. I guess I have to run gulp --production on my MAMP environment and copy everything over via FTP afterwards as I have limited access (FTP only) to the production server. I know guys, this is far from ideal, I am investigating in a better workflow but I need some more time.

  3. What exactly will be happening with the Assets folder? It will be ignored after running gulp --production and the Dist folder will be used instead? Should I copy the Assets folder to the production environment or can I forget about that folder in production?

  4. Any other files or folders that should not be copied over to production?

  5. What about the environment variable? Where has it gone? It’s not in functions.php anymore. No need to change anything before moving to production or running gulp --production? What about devUrl in manifest.json?

  6. Let’s say I need to change a few things on my website. Because my workflow currently sucks, the best way to do this would be FTP’ing everything back to development but all my files will be minified, renamed after running gulp --production, right? How do I get everything back as it was before running gulp --production?

Any other recommandations? "Not being scared of the gulp --production command I guess? :slight_smile: Anything I haven’t covered and is required to move from dev to prod?

Thanks a lot for taking the time to answer my questions! I’d appreciate your feedback!

Best regards
Steven

3 Likes

Nothing should be loaded from the assets folder. By default, whether you run gulp or gulp --production, everything is loaded from dist, and dist is git ignored by default.

By running gulp all your CSS and JS files are being combined, minified, etc. Fonts and images are being moved. Literally the only difference by adding the --production flag is the final files are appended with a hash and a json file is created in the dist folder which is used by the theme to enqueue those files correctly to WP.

So yes, you should not be afraid to run gulp --production. Every time you run gulp, the dist folder is completely wiped anyways, and rebuilt. So if you want production assets and then not, just run gulp and your assets will be compiled again just without the hashes.

4 Likes

Hi people,
thank you for your usefull comments.

Actually, i tried “gulp --production” and i uploaded the folder of my new wordpress theme, except “node_modules” and “bower_components”. But after uploaded the theme, my website is not working anymore. And i must erase the new theme to fix the thing.

So… I suppose i missed something. i am still looking for it, reading the official book of Sage 2nd edition, and reading the comment on this forum.

I am not using trellis and bedrock so far but i am documenting myself about it for a next projet.

I just would like to know in details what are the steps to make my theme ok, after the “gulp --production” step. Which files should i upload ? the whole folder ? did i miss something at the beginning of the process to make my new theme working ?

Could you help me, please ?
thanks in advance

it’s me again.
i may found a similar problem : Sage 8.0.0 & WordPress Theme Issue

OK
I found the solution : to update the php version of my wordpress website.
Thanks