fniessen / org-html-themes

Transform your Org mode files into stunning HTML documents in minutes with our Org mode HTML theme. Elevate your productivity and impress your readers! #orgmode #html #theme #productivity #design

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use local jquery and bootstrap instead of CDN ones

adamcavendish opened this issue · comments

Using org-mode for note taking without internet connection is quite common, and if we're not using the local jquery and bootstrap we probably cannot even view the rendered org html file. It would be very nice if we make the resources available at local filesystem.

Isn't this pretty forward the way it is? You can either git clone the project to a fixed place, and hardcode those paths in a global setup file, or clone it in a subdir of your project, and use a setup file with relative paths.

@fniessen So how do you think, which of these paths are relative? This is from theme-readtheorg-local.setup file:

#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="styles/readtheorg/css/htmlize.css"/>
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="styles/readtheorg/css/readtheorg.css"/>

#+HTML_HEAD: <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
#+HTML_HEAD: <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="styles/lib/js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="styles/readtheorg/js/readtheorg.js"></script>

Also, if you look at readtheorg.css file you will see this:

@import url(https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic|Roboto+Slab:400,700|Inconsolata:400,700);
@import url(https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css);

Relative my ass.

+1, this needs to be fixed.

I'm not your slave -- and dislike being mistreated. Closing this, without fix.

Except that you've mistreated the OP twice. Once by refusing to think for a second to see the issue, and once again by closing this for my remark. But sure, it is your project, do whatever you like ;)

I wonder whether I should use npm dependency instead. Maybe I can make a pull request. What do you think, @fniessen

npm is not familiar to me, and not sure it's easy to install on Windows (my case). Platform openness must stay a priority.

Now, if you "relativise" some paths, the files can simply be included in the Git repo. Are there drawbacks?

For the rest, I'm sorry but I really can't accept extra work at this time -- still juggling with real job(s) and family. Though, I you can make such a PR (files locally in the Git repo), it'd be welcomed.

If the platform independency is important, yeah, you're right, using CDN would be the best choice. I know your concern now. Thx. Cheer up, and have a good day.

Adam, you did not answer my question about drawbacks of including extra files in the Git repo. Does the need for platform independency "close" this issue?

No, and actually it is ok to do it. However, if not managed via package manager, the size of the repo would inflate.

The problem of using package managers would be actually getting windows users in pain, like getting to setup for the PATH, installing unnecessary stuffs (nodejs, npm) ...

The issue is still not resolved. Making it easy for some people to make their installations local does not mean that everybody else (e.g. Windows users) will have to go the same path. For example, a Makefile that creates org-*-local.setup file (using npm or whatever) will do the job, and everybody else can simply use a non-local setup file.

@AlexDaniel Good idea. I'll help do it.

@adamcavendish Any progress on this?

For the Debian package I'm planning, I'm not sure if it would be better to default to catering to the "Using org-mode for note taking without internet connection is quite common, and if we're not using the local jquery and bootstrap we probably cannot even view the rendered org html file", or web-server use case.

I've been thinking about something like the following:
The existing setup/theme-foo.setup design seems like it can solve both cases, with a choice between theme-foo-local.setup and theme-foo-cdn.setup, and it just seems to be a case of providing a sensible example of theme-foo-local.setup, and noting it in the README.

That said, even if these were provided, it doesn't solve the issue of having to type in the full:

#+SETUPFILE: path/to/Git/repo/setup/THEME-NAME-local.setup

for each project.

It would be nice to provide a method to provide a default SETUPFILE value. Beyond that, some kind of menu, popup, or autocompletion candidate seeding might be nice to have.

Cheers,
Nicholas

Those files are not big, so IMO adding them to the repository is not a problem (jquery is 83kb, bootstrap is 36kb). Right now I'm workarounding it with this script that I run on org html exported files so that I can share a single HTML that is self contained (except for images right now)

The original code came from stack overflow, so it should be public domain, so mine has the same license (btw, Now it includes external files and images ^^)

Since we are talking about local javascript it seems difficult that CVE are present. And, by the way, the full/versioned path is included (jquery/2.1.3/jquery.min.js) so a manual intervention to update it is already required (and, just to add extra motivations: jquery 2.1.3 is no longer patched, according to jquery homepage)