Also,
- Is Node.js essential for frontend dev (or fullstack), nowadays?
- How do non-Node (e.g. PHP, Python, Ruby, Go) optimize for SEO?
- Even if I use Node.js bundlers, how do I audit / optimize other aspects of SEO?
Also,
For further actions, you may consider blocking this person and/or reporting abuse
Agbo, Daniel Onuoha -
Tomi Longe -
Alois Seฤkรกr -
Talha Ahsan -
Top comments (7)
No Don't release minified scripts.
For production, yes. But that should be the last step, right before final testing.
Even if one is worried about CDNs hosting your JS script directly from NPM/GitHub, jsDelivr will minify code for you; just add
min
:jsdelivr.com/features
There are a number of minifiers in most languages, though I think it would be hard to implement inside inline
<script />
tags. If it's just a few lines don't worry. If it grows, it's not to hard to pull it into its own.js
file, minify it to.min.js
then load that.Maybe, but even the most popular WordPress doesn't seem to minify anything...
What are the tools most popular for Django devs use, for example? I'd like to hear that.
I don't know about Django but searching minify js with python has a number of possible options. Maybe someome with more Django experience will chime in
Can't you use
<script type="module">
? Or try snowpack.dev/#litelement. If you need minify,snowpack --optimize
is there.I have some aversion to Golang.
I definitely mean Python dev handwrite JavaScript in
<script>
tags or*.js
. I used to do that in the past, with jQuery as well. (And actually, there is one more concern -- Is it safe to use let or const in a <script> tag without a bundler?)I also used to handwrite
*.css
without minification as well.If you use Blade / Twig / Jinja / GoHtml, HTML-minification is the default. But if you use
*.html?
extension, how do you minify it without Node.js?What do you usually use, if you don't have Webpack / Parcel / Gulp / Grunt, etc.? Also, CSS, or do you use preprocessors?
You can use a locally installed CLI tool to run the minification, and add it to your build pipeline (or Makefile or shell script or whatever ya got).
That said, it's convenient to be able to use
npm
to hook everything up, and obviously node has html-minifier readily available. I've used it in projects with virtually no JavaScript just for the build tooling, it disappears in the deployed bundle.