-
Notifications
You must be signed in to change notification settings - Fork 2.3k
migrate web-client development from grunt to vite #4284
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
Conversation
fcf76e4 to
1aa8135
Compare
|
@vojkovic I remember you have custom LESS for the theme .. this PR will move the sources from |
|
@return42 I appreciate you letting me know - I'll follow this PR and make the changes once the merge happens. :-) |
1aa8135 to
16c99d2
Compare
Bnyro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the JavaScript on the results page is currently not being loaded properly - I can't tell why exactly yet.
To reproduce: Try to Shift-select additional categories with the left mouse button - works on the latest master but not with this PR.
a55e11d to
032aac7
Compare
|
Running this now in production on my instance. privau/searxng@e64d2b9 Haven't noticed any issues just yet. But did notice a considerable speedup in the frontend build time. :) As mentioned, the main issue currently looks to be that the css sourcemaps not being built. |
|
@return42 Noticed something! - the new svg optimiser seems to be breaking a few svgs like the information-circle and news category icon. There are internal shapes not being coloured. |
…n names This patch implements the template generation of the template: searx/templates/simple/icons.html by the way the icon set (the icon names) has been normalized: film-outline --> film magnet-outline --> magnet .. warning --> alert Some missing (categorie) icons had been added. Some of the ionicons are not suitable for a dark theme, we fixed the svg manually in src/svg/ionicons: - searxng#4284 (comment) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
032aac7 to
1664262
Compare
It's not the optimizer ... it's the icons themselves:
News icon haven't changed (was also broken before) .. but in the old client we had a manually fixed info icon. I now fixed both icons --> see diff |
Vite is a build tool, it consists of two major parts [1]: - A dev server that provides rich feature enhancements over native ES modules, for example extremely fast Hot Module Replacement (HMR). - A build command that bundles your code with Rollup, pre-configured to output highly optimized static assets for production. [1] https://vite.dev/guide/ Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
…n names This patch implements the template generation of the template: searx/templates/simple/icons.html by the way the icon set (the icon names) has been normalized: film-outline --> film magnet-outline --> magnet .. warning --> alert Some missing (categorie) icons had been added. Some of the ionicons are not suitable for a dark theme, we fixed the svg manually in src/svg/ionicons: - searxng#4284 (comment) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
…to static by plg_svg2svg Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
…vers Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
- upgrade to ubuntu-24.04 to get NodeJS v20 - remove DEBUG (V=1) environment / in a ViteJS env the DEBUG environment is reserved for interactive debugging tasks (not for verbose build messages). Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
BTW: Rename the manufacturer-specific name ``ion-icon`` of the icon set in SerXNG to ``sxng-icon-set`` --> The icon set can be assembled together as desired in the FE and should therefore not have a manufacturer-specific name in the style and template definitions. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Related: - searxng#4322 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
| const simple_icons = [ | ||
| { | ||
| base: resolve(HERE, "node_modules/ionicons/dist/svg"), | ||
| set: { | ||
| "alert": "alert-outline.svg", | ||
| "appstore": "apps-outline.svg", | ||
| "book": "book-outline.svg", | ||
| "close": "close-outline.svg", | ||
| "download": "download-outline.svg", | ||
| "ellipsis-vertical": "ellipsis-vertical-outline.svg", | ||
| "file-tray-full": "file-tray-full-outline.svg", | ||
| "film": "film-outline.svg", | ||
| "globe": "globe-outline.svg", | ||
| "heart": "heart-outline.svg", | ||
| "image": "image-outline.svg", | ||
| "layers": "layers-outline.svg", | ||
| "leecher": "arrow-down.svg", | ||
| "location": "location-outline.svg", | ||
| "magnet": "magnet-outline.svg", | ||
| "musical-notes": "musical-notes-outline.svg", | ||
| "navigate-down": "chevron-down-outline.svg", | ||
| "navigate-left": "chevron-back-outline.svg", | ||
| "navigate-right": "chevron-forward-outline.svg", | ||
| "navigate-up": "chevron-up-outline.svg", | ||
| "people": "people-outline.svg", | ||
| "play": "play-outline.svg", | ||
| "radio": "radio-outline.svg", | ||
| "save": "save-outline.svg", | ||
| "school": "school-outline.svg", | ||
| "search": "search-outline.svg", | ||
| "seeder": "swap-vertical.svg", | ||
| "settings": "settings-outline.svg", | ||
| "tv": "tv-outline.svg", | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vojkovic: while we are just talking about icons .. this PR also fix some very old issues with some missing SVGs: e.g. SVGs for seeder, lecher and file size (save) had been missed in the past ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice - great work with this mate.
1664262 to
7d08c69
Compare
|
Looks good - I had a look at the issue with vite not generating the css source maps. I read over the github discussion and even after checking the source of vite, I can't get them to build either. |
| themes.live() { | ||
| local LIVE_THEME="${LIVE_THEME:-${1}}" | ||
| case "${LIVE_THEME}" in | ||
| simple) | ||
| theme="searx/static/themes/${LIVE_THEME}" | ||
| ;; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read over the github discussion and even after checking the source of vite, I can't get them to build either.
@vojkovic many thanks for your research on this .. I guess the issue is related to the minification of the CSS .. but for the build phase I prefer to to minify ..
Vite consists of a builder and a server, this PR only implements the build,
in a follow up PR I will integrate vite's development server in a (new) themes.live command .. then, in the development phase we don't need to minify and have CSS source maps back .. at least I hope so ;-)
BTW: we already have a similar issue with LESS & CSS
- [fix] LESS sourcemaps broken in less-plugin-clean-css v1.6.0 #4215
- Sourcemaps broken in latest v1.6.0 less/less-plugin-clean-css#42 (comment)
The problem may lie in a sub-sub-sub dependency and therefore affects both (vite and less-plugin-clean-css)... but I can only speculate about that ..
Bnyro
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested again, looks good to me now! 👍
…n names This patch implements the template generation of the template: searx/templates/simple/icons.html by the way the icon set (the icon names) has been normalized: film-outline --> film magnet-outline --> magnet .. warning --> alert Some missing (categorie) icons had been added. Some of the ionicons are not suitable for a dark theme, we fixed the svg manually in src/svg/ionicons: - #4284 (comment) Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
…ort) In commit 1a3543d in PR-4284 [1] the swiped-events [2] were forgotten to be migrated. In this patch, the event library is added to the ``devDependencies`` and imported by:: import "../../../node_modules/swiped-events/src/swiped-events.js [1] searxng#4284 [2] https://www.npmjs.com/package/swiped-events Signed-off-by: Markus Heiser <markus.heiser@darmarit.de> Reported-by: searxng#4198 (comment)
…ort) In commit 1a3543d in PR-4284 [1] the swiped-events [2] were forgotten to be migrated. In this patch, the event library is added to the ``devDependencies`` and imported by:: import "../../../node_modules/swiped-events/src/swiped-events.js [1] #4284 [2] https://www.npmjs.com/package/swiped-events Signed-off-by: Markus Heiser <markus.heiser@darmarit.de> Reported-by: #4198 (comment)
The previously used library is unmaintained for 6 years now [1] and the solution had know issues [2][3] [1] searxng#4284 (comment) [2] searxng#4318 (comment) [3] privau/searxng#56
The previously used library is unmaintained for 6 years now [1] and the solution had know issues [2][3] [1] #4284 (comment) [2] #4318 (comment) [3] privau/searxng#56
The previously used library is unmaintained for 6 years now [1] and the solution had know issues [2][3] [1] searxng#4284 (comment) [2] searxng#4318 (comment) [3] privau/searxng#56
What does this PR do?
Migrate web client development (simple theme) from grunt to Vite.
Vite consists of a builder and a server, this PR only implements the build, what grunt has done so far. We will integrate the vite server into our development processes in a followup PR.
Why is this change important?
How to test this PR locally?
Start a server (
make run) and see if there are no changes in the frontend. Apart from a few small bugs that have been fixed around the icons, this PR should not bring any changes from the user's point of view.To test FE development jump to folder
client/simpleand have a look at the README there.Notes
The switch to vite in this PR will enable us to develop our FE faster and more securely in future (e.g. we do no longer rely on unmaintained components and can benefit from state of the art technologies).
This PR deliberately avoids changes to the JS code and adopts it 1:1 for the time being. In further PRs we should then restructure the JS code base to JS modules (and imports/exports).
The migration to vite currently still has one catch: I have not been able to generate the source maps for the CSS that are generated from the LESS ... perhaps we can find a solution for this in the course of the review ..
Related issues
Closes: #141