-
Notifications
You must be signed in to change notification settings - Fork 3
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
Minimize CSS when running lektor server
with NODE_ENV=production
#5
Conversation
When will that be set? Can it be set from any tool are must be set by user manually? |
4cb507d
to
1e5a157
Compare
For lack of better ideas, yes, I was envisioning it being set manually, or in some external way. E.g. I now use I'm open to alternative ideas for switch modes. Some ideas:
|
I prefer this method. Let's do it. |
The more I think about this, the more I prefer using $NODE_ENV. Refs:
Various magics whereby JS transpilers treat NODE_ENV as a compile-type constant, thus removing debug code (upon minimization) from code transpiled with NODE_ENV="production":
Also, I think it would minimize confusion if
Note that Lektor flags can take an argument, so we could do something like # minimize CSS
lektor server -f production:true
# or
lektor build -f production:true
# non-mimize CSS
lektor server -f production:false
# or
lektor build -f production:no (and the default can be whatever we decide...) |
But it's also a common practice in JS world that commands for different purpose set
|
@frostming Good enough! Thank you! |
Currently, the generated CSS is minimized when running
lektor build
, but not when runninglektor server
.If one publishes their site using the "Publish" button in the Lektor GUI, one publishes un-minimized CSS.
This PR minimizes the CSS in
lektor server
mode if the$NODE_ENV
environment variable is set to"production"
.NOTE: This PR is stacked on PR #4. It should be merged after that one. (It may also require rebasing, depending on how #4 is merged.)