philnash / jekyll-gzip

Generate gzipped assets and files for your Jekyll site at build time
https://rubygems.org/gems/jekyll-gzip
MIT License
37 stars 8 forks source link

Instructions in Usage result in a error #3

Closed Barsonax closed 5 years ago

Barsonax commented 6 years ago

When working through Usage I noticed that the following command does not work:

PS C:\Users\RickvanDam\source\repos\Barsonax\Barsonax.github.io> JEKYLL_ENV=production bundle exec jekyll build
JEKYLL_ENV=production : The term 'JEKYLL_ENV=production' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that
the path is correct and try again.
At line:1 char:1
+ JEKYLL_ENV=production bundle exec jekyll build
+ ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (JEKYLL_ENV=production:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Iam running this on windows.

philnash commented 6 years ago

Ah, apologies, I wrote the instructions and ran them on my Mac only. I guess this is not how Windows machines set environment variables.

I don't think you can set an environment variable inline like this on Windows. You could look into setting the JEKYLL_ENV variable using the set command and then run bundle exec jekyll build after.

If you are able to get through this, I'd really appreciate a pull request that updates the Usage section with your experiences so that this gem can better support Windows developers too.

Barsonax commented 6 years ago

Already tried that but it seems jekyll is not fooled by that :)

philnash commented 6 years ago

Do any of the windows instructions in this blog post help?

Barsonax commented 6 years ago

Tried it: image

But when I run bundle exec jekyll build I don't see any gzip files.

philnash commented 6 years ago

Where are you looking for the gzipped files?

Barsonax commented 6 years ago

In the _site folder. I only see html, css etc files there.

philnash commented 6 years ago

Have you added jekyll-gzip to the plugins array in your _config.yml?

(I didn’t think this was necessary, but maybe it is and I’ll need to update the instructions.)

Barsonax commented 6 years ago

No I haven't done that yet. I only added it to the gemfile like the instructions said.

philnash commented 6 years ago

Ah, give that a go and let me know if it helps. Then I’ll update the Readme.

philnash commented 6 years ago

Was this the solution? Would love to get it into the README if that's what I was missing.

Barsonax commented 6 years ago

Haven't had the time yet to check.

philnash commented 6 years ago

Ok, let me know when you do! Thanks!

Barsonax commented 6 years ago

I still don't see any gzip's

EDIT: argh forgot to hit the save in vs code. Now I do see the gzip files image

Is it normal the normal assets are still there?

Barsonax commented 6 years ago

To summarize:

  1. Add jekyll-gzip to your plugins node in _config.yml
  2. Add gem 'jekyll-gzip' to your Gemfile
  3. Run bundle install
  4. Create a new JEKYLL_ENV environment variable and set the value to production
  5. Close VS code and reopen it (so that it picks up the new variable)
  6. Run bundle exec jekyll build
  7. You will see gzip files in the _site folder
philnash commented 6 years ago

Hooray!

It is normal that the regular assets remain, if a user agent requests the asset but doesn't say that it will accept gzip as an encoding we want to be able to serve the original asset.

I will try to write up the extra instructions around environment variables for Windows. I have already added the bit about adding to the plugins section in _config.yml.

Thanks for working through this with me!