Skip to content
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

[new_plugin] minification #1362

Open
dArignac opened this issue Feb 22, 2022 · 25 comments
Open

[new_plugin] minification #1362

dArignac opened this issue Feb 22, 2022 · 25 comments

Comments

@dArignac
Copy link

dArignac commented Feb 22, 2022

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

@justinmayer
Copy link
Member

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?

@kernc
Copy link
Contributor

kernc commented Feb 23, 2022

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).

@dArignac
Copy link
Author

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).

@kernc
Copy link
Contributor

kernc commented Feb 24, 2022

Your implementation, however, depends on packages htmlmin and csscompressor, which haven't been touched in years.

@nkr0
Copy link
Contributor

nkr0 commented Aug 7, 2022

@dArignac why do you only minify inline js and not js files in the build folder?

@S1SYPHOS
Copy link

S1SYPHOS commented Oct 5, 2022

@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 😁

@dArignac
Copy link
Author

dArignac commented Jan 3, 2023

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.

@S1SYPHOS
Copy link

S1SYPHOS commented Jan 3, 2023

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!

@dArignac
Copy link
Author

Ok, not seeing this going anywhere, therefore closing my request.

@justinmayer
Copy link
Member

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?

@justinmayer justinmayer reopened this Jul 26, 2023
@dArignac
Copy link
Author

Hi Justin, alright, thanks for picking it up again.

@justinmayer
Copy link
Member

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.

@dArignac
Copy link
Author

Sure, invites were sent.

@justinmayer
Copy link
Member

Excellent. Thank you, Alexander! 😊

@justinmayer
Copy link
Member

justinmayer commented Jul 31, 2023

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:

How does that sound? Any steps I should add to this list?

@dArignac
Copy link
Author

dArignac commented Aug 1, 2023

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 👍🏻

@justinmayer
Copy link
Member

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. 😊

@dArignac
Copy link
Author

dArignac commented Aug 2, 2023

I'd work on the next open points, also need to make myself familiar with autopub.

@justinmayer
Copy link
Member

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!

@dArignac
Copy link
Author

dArignac commented Aug 2, 2023

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`

@justinmayer
Copy link
Member

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.

@dArignac
Copy link
Author

dArignac commented Aug 4, 2023

@justinmayer Notice was added.

@justinmayer
Copy link
Member

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. 🤔

@dArignac
Copy link
Author

I will take care of this within the next days.

@dArignac
Copy link
Author

A note was added to the new patch version of the old plugin: https://pypi.org/project/pelican-minification/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants