pelican-plugins
pelican-plugins copied to clipboard
[new_plugin] minification
Hi there,
I have a plugin that does minification of the HTML, CSS files as well as inline styles and javascript and would like to move it to here. I prepared the structure and setup according to your cookiecutter in my branch here: https://github.com/dArignac/pelican-minification/tree/5-add-to-pelican-plugins
Best, Alex
Hi Alexander. Thank you for reaching out. For my own education, would you please let me know how the plugin differs from the WebAssets plugin?
would you please let me know how the plugin differs from the WebAssets plugin?
Webassets doesn't minify HTML. And there is no good alternative (package css-html-js-minify
, a dep of plugin css-html-js-minify
, seems abandoned).
As pointed out by @kernc, our plugin additionally minifies HTML. It does not do any of the webassets based capabilities as listed in the webassets plugin page (cache busting, spritemaps, data URIs).
Your implementation, however, depends on packages htmlmin and csscompressor, which haven't been touched in years.
@dArignac why do you only minify inline js and not js files in the build folder?
@nkr0 .. because files in the build folder are not part of the (generated) HTML document
// Update: I had a quick look at the source .. yeah, it seems odd that external CSS files are minified (if enabled via CSS_MIN
), but JS files aren't - I'd be interested to hear from you, @dArignac :grin:
Howdy! It's been a while, thanks for your comments! I was now able to review your comments and to update the code.
@S1SYPHOS @nkr0 everything is now minified: JS, CSS, HTML files and inline CSS & JS @kernc I changed to https://github.com/wilsonzlin/minify-html for minification as the only lib. It's somewhat up to date.
In the meantime I developed something on my own using a minifier written in Golang (using its Python bindings), but I guess I didn't release it to the public yet 😅
If I find the time, I'll gladly check out your changes, thanks for letting me know!
Ok, not seeing this going anywhere, therefore closing my request.
Hey Alexander. Please accept my sincere apologies for the delay in getting back to you about your request. It has been a particularly busy period.
I would be happy to set up a separate repository for this plugin under the new Pelican Plugins organization so that we can collaborate on its development. I will update this issue by the end of next week with further details and next steps. How does that sound?
Hi Justin, alright, thanks for picking it up again.
Certainly! To that end, would you be so kind as to add the following two usernames with Owner
role to the PyPI project?
-
jmayer
(me) -
pelicanteam
(Pelican Development Team)
That way, once the repository has been set up, future releases can be published to PyPI via the same automated process as the other plugins under the Pelican Plugins organization.
Sure, invites were sent.
Excellent. Thank you, Alexander! 😊
I have created the new repository under the Pelican Plugins organization. When doing so, it occurred to me that the “pelican-minification” name is a bit cumbersome and has problems with auto-correct, and that “minify” would be a cleaner, better name for the plugin. The pelican-minify
namespace on PyPI was already taken, but the last release was in 2015 and was created by someone I know, so I asked if the Pelican community could take over that project name on PyPI. That request was kindly granted, so we now have the ability to publish to pelican-minify
on PyPI.
Following is a proposed list of steps that will eventually lead to publishing version 2.0.0 to PyPI from the plugin’s new repository:
- [x] Create repository under Pelican Plugins organization
- [x] Create
migrate
branch containing relevant commits from5-add-to-pelican-plugins
branch - [x] Replace Poetry with Hatchling+PDM
- [x] Replace Flake8/Isort with Ruff
- [x] Update CI workflow, including PyPI Trusted Publisher functionality
- [x] Solicit feedback from @dArignac & Pelican community members: https://github.com/pelican-plugins/minify/pull/1
- [x] Merge
migrate
branch tomain
- [x] Release version 2.0.0 and upload package to PyPI as
pelican-minify
- [ ] Justin: Publish notice & link to new repo/PyPI pages @ legacy
pelican-minify
repository - [x] Alexander: Publish notice & link to new repo/PyPI pages @ legacy
pelican-minification
repository - [x] Alexander: Publish notice & link to new repo/PyPI pages @ legacy
pelican-minification
PyPI project
How does that sound? Any steps I should add to this list?
Hi Justin,
that sounds good, cannot think of any additional action item. Will review the PR then. Thanks a lot for doing the heavy lifting and moving everything over 👍🏻
My pleasure. I just re-worked the commits in that PR's migrate
branch in order to better preserve the committer/date metadata. I look forward to your comments on the PR. 😊
I'd work on the next open points, also need to make myself familiar with autopub.
For the next step in the process, it's probably easier for me to handle the release. All of the release publication machinery is already in place; it's just a question of deciding what to put in the release notes / change-log.
I will endeavor to finish that step later today. But once that is done, your help with the last two steps would be helpful and much appreciated!
I think the CHANGELOG.md
needs to be renamed for autopub
.
We could put that as release notes:
2.0.0
------------------
- restructured according to Pelican plugin guidelines and released under pelican-plugin organization
- Add `JS_MIN` setting and ability to minify JavaScript files
- Replace all minifiers with `minify_html`
Version 2.0.0 of the Minify plugin has been released 🎊
(There was a minor hiccup with the release automation due to some missing project metadata, but that should now be fixed.)
@dArignac: If you would be so kind as to publish a notice & link to the new repo/PyPI pages on the pelican-minification repository README, that would be wonderful.
@justinmayer Notice was added.
Great! I don't know if there is an easy way to do the same for the README on the PyPI page. The only way I can think of would be to publish version 1.0.1 to that project so the notice you added to the repo's README is updated on the PyPI page. 🤔
I will take care of this within the next days.
A note was added to the new patch version of the old plugin: https://pypi.org/project/pelican-minification/