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

Static files: move source to a dedicated directory. #141

Open
dalf opened this issue Jun 10, 2021 · 6 comments
Open

Static files: move source to a dedicated directory. #141

dalf opened this issue Jun 10, 2021 · 6 comments
Labels
new feature New feature or request

Comments

@dalf
Copy link
Member

dalf commented Jun 10, 2021

Since it is a topic in itself, here a new issue :

From #137 (comment)

In first order we should separate source code from the ./searx/static folder.

I would see:

  • src/static
  • src/searx
  • src/searx/static <-- built files

But a lot of stuff expect searx source code in the searx directory.

So If the source folder for the static files is static/src or just static.

static (or static/src)
	themes
		oscar
			img           # searx/static/themes/oscar/css/images AND searx/static/themes/oscar/css/img
			js            # searx/static/themes/oscar/src/js
			less          # searx/static/themes/oscar/src/less
			package.json
			gruntfile.js
			README.rst
		simple
			js            # searx/static/themes/simple/js/searx_head AND searx/static/themes/simple/js/searx_src
			less          # searx/static/themes/simple/less
			...           # incomplete because a similar PR to https://github.com/searx/searx/pull/2346 must be done
			gruntfile.js
			package.json
@dalf dalf added the new feature New feature or request label Jun 10, 2021
@return42
Copy link
Member

I would see:

  • ...
  • src/searx/static <-- built files

But a lot of stuff expect searx source code in the searx directory.

For the first step we should leave the static build products where they are and move only the source files of the build products to another location

So If the source folder for the static files is static/src or just static.

Hm, why not ./src/static? .. and build products will be generated at searx/static (as is)

BTW: what about the files in ./searx/data, I mean the sources that generate these files? Should we move searx_extra/update also to src/data? At the end we have something like:

.
├── doc
~
├── searx
│   ├── data
│   ├── static
│   │   ├── plugins
│   │   └── themes
~
└── src
    ├── data
    └── static

I would see:

src/..

If there comes the day we think it is a good idea, we can also move ./searx to ./src/searx

@dalf
Copy link
Member Author

dalf commented Jun 13, 2021

Hm, why not ./src/static ?

👍

There are files that are not compiled:

  • searx/static/themes/oscar/fonts
  • searx/static/themes/oscar/img
  • searx/static/themes/oscar/css/images

I'm not sure what to do for these files.

@return42
Copy link
Member

Leave them where they are .. in a second step, we can have a look what files can be generated ... E.g.

  • searx/searx/static/themes/simple/img/favicon.png can be genrated from searx/static/themes/simple/img/searx_logo.svg and
  • fonts can be updated from their origin
  • ..

@return42
Copy link
Member

@dafl are you implementing the move to src/ .. or should I give it a try?

@dalf
Copy link
Member Author

dalf commented Jun 15, 2021

I will do it.

@return42
Copy link
Member

return42 commented Aug 1, 2021

In #151 we have moved source files to the src directories below the themes/*/src, this was the first step.

The next step should be to move the themes/*/src to /src/*/static, see #151 (comment)

Moving the source files includes moving the gruntfile.js and package.json of the themes (in the simple themes additional .jshintignore, .jshintrc and.stylelintrc.json needs to be moved).

static/themes/__common__ needs a more elaborate treatment, I assume js/image_layout.js is only used by oscar theme.

@dalf should I give it a try / I assume that you know more about this topic but if you do not have time, I could give it a try (might be a good exercise for me).

return42 added a commit to dalf/searxng that referenced this issue Dec 1, 2021
Include the source files directly in the `.map` files [1] for two reasons:

1. In the simple theme, modules from `./node_modules` are only available on
   developer's build host (a `make node.env` is needed to get the sources).  By
   example; in the `searxng.min.js.map` file, the `autocomplete.js` is linked at
   URL:

      ../node_modules/autocomplete-js/dist/autocomplete.js

2. Later, when client sources has been moved out of the `./static` URL [2] to
   the `<repo-roo>/src` folder, all JS sources are no longer available.

Drawback: `.map` files grow up in size, but this should not bother, because the
files are only loaded in debug mode.

[1] https://github.com/gruntjs/grunt-contrib-uglify#sourcemapincludesources
[2] searxng#141

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this issue Dec 1, 2021
Include the source files directly in the `.map` files [1] for two reasons:

1. In the simple theme, modules from `./node_modules` are only available on
   developer's build host (a `make node.env` is needed to get the sources).  By
   example; in the `searxng.min.js.map` file, the `autocomplete.js` is linked at
   URL:

      ../node_modules/autocomplete-js/dist/autocomplete.js

2. Later, when client sources has been moved out of the `./static` URL [2] to
   the `<repo-roo>/src` folder, all JS sources are no longer available.

Drawback: `.map` files grow up in size, but this should not bother, because the
files are only loaded in debug mode.

[1] https://github.com/gruntjs/grunt-contrib-uglify#sourcemapincludesources
[2] searxng#141

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
return42 added a commit to return42/searxng that referenced this issue Dec 1, 2021
Include the source files directly in the `.map` files [1] for two reasons:

1. In the simple theme, modules from `./node_modules` are only available on
   developer's build host (a `make node.env` is needed to get the sources).  By
   example; in the `searxng.min.js.map` file, the `autocomplete.js` is linked at
   URL:

      ../node_modules/autocomplete-js/dist/autocomplete.js

2. Later, when client sources has been moved out of the `./static` URL [2] to
   the `<repo-roo>/src` folder, all JS sources are no longer available.

Drawback: `.map` files grow up in size, but this should not bother, because the
files are only loaded in debug mode.

[1] https://github.com/gruntjs/grunt-contrib-uglify#sourcemapincludesources
[2] searxng#141

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new feature New feature or request
Projects
Status: Needs Triage
Development

No branches or pull requests

2 participants