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

lessc creates different css than less_middleware #328

Open
epaulson opened this issue Dec 7, 2021 · 1 comment
Open

lessc creates different css than less_middleware #328

epaulson opened this issue Dec 7, 2021 · 1 comment

Comments

@epaulson
Copy link
Collaborator

epaulson commented Dec 7, 2021

I've been wondering a bit about how 'Click ' isn't centered in my install of c-t-h. I've got the map tiles turned off, but here's what I get:

Screen Shot 2021-12-06 at 7 18 29 PM

Here's what I should get:
Screen Shot 2021-12-06 at 7 19 05 PM

The difference is that my CSS file comes from being built by the less-middleware. If I compile and replace styles.css by using lessc, then it's correctly centered as in the 2nd image. If I 'touch' styles.less to make it look like I edited the .less file, and reload the site, the less-middleware notices and rebuilds styles.css, resulting in the incorrect centering for the 1st image - and maybe other CSS issues.
(I figured this out by downloading the CSS from click-that-hood.com and noticing that it correctly centered with that CSS)

Part of the problem is I don't think 'npm run build' actually invokes lessc for me, because I don't have lessc in my PATH, so it doesn't run, but since I run 'npm start' as my next step, less-middleware built styles.css so there actually is some CSS in the public/css directory, just not the right CSS.

Since you're working towards eliminating less-middleware, I don't see any reason to debug it - should I just take less-middleware out of app.js, or should we eliminate app.js and tell people to serve the static HTML using python -m http.server or whatever their favorite small webserver is?

Would you also be OK with a PR that changed package.json from

"build": "node build.js && lessc public/css/styles.less public/css/styles.css",

to

"build": "node build.js && node_modules/less/bin/lessc public/css/styles.less public/css/styles.css",
@fnogatz
Copy link
Member

fnogatz commented Dec 8, 2021

Ah, this issue addresses several different things. First of all, let me point out that the prefix node_modules/less/bin/lessc is not required in npm scripts, since npm automatically adds the binaries of all installed modules to the PATH, as stated in the documentation:

In addition to the shell's pre-existing PATH, npm run adds node_modules/.bin to the PATH provided to scripts. Any binaries provided by locally-installed dependencies can be used without the node_modules/.bin prefix. For example...

The other things are:

  • Position of the Click overlay: I'm not sure what's the expected result actually is. I would prefer to have the Click overlay centered above the displayed map instead of centered wrt. to the browser window.
  • app.js: It's simply no longer required at all. We should remove this file, remove the npm start script in package.json, and change the README.md accordingly to just open public/index.html.

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

2 participants