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

customization: css #5

Closed
ppanero opened this issue Oct 1, 2019 · 7 comments
Closed

customization: css #5

ppanero opened this issue Oct 1, 2019 · 7 comments

Comments

@ppanero
Copy link
Member

ppanero commented Oct 1, 2019

Support loading/adding custom CSS

@ppanero ppanero added this to To do in InvenioRDM November Board via automation Oct 1, 2019
@ppanero ppanero added this to To do in InvenioRDM December Board via automation Dec 2, 2019
@fenekku fenekku added this to To do in InvenioRDM January Board via automation Dec 3, 2019
@fenekku fenekku removed this from To do in InvenioRDM December Board Dec 20, 2019
@ppanero ppanero self-assigned this Jan 8, 2020
@ppanero ppanero moved this from To do to In progress in InvenioRDM January Board Jan 8, 2020
@ppanero
Copy link
Member Author

ppanero commented Jan 13, 2020

Made to work in debug mode. Steps to follow:

  1. Install invenio-app-rdm.
  2. Edit the config.py and add:
from invenio_app.config import APP_DEFAULT_SECURE_HEADERS

APP_DEFAULT_SECURE_HEADERS['content_security_policy'] = {}
WEBPACKEXT_STORAGE_CLS = 'pywebpack.storage.LinkStorage'
  1. Install invenio-assets from GitHub master branch.
    • Edit the invenio_assets/assets/build/webpack.config.js and add:
var webpackConfig = {
  ...
  resolve: {
    ...
    symlinks: false
  },
...
}
  1. Since --watch does not work with symlinks we need to edit DirectoryWatcher.js. Edit <instance_path>/assets/node_modules/watchpack/lib/DirectoryWatcher.js
function DirectoryWatcher(directoryPath, options) {
        ...
	this.watcher = chokidar.watch(directoryPath, {
                ...
		followSymlinks: true,
  1. Open two terminals: In each one of them export:

    • FLASK_ENV=development
    • NODE_PRESERVE_SYMLINKS=1
  2. In Terminal 1 run:

./scripts/bootstrap
./scripts/setup
 invenio run --cert ./docker/nginx/test.t --key ./docker/nginx/test.key 
  1. In Terminal 2 run:
invenio webpack run start

Starting implementing the changes in the correct places.

Kudos @slint for the guidelines and work :)

@slint
Copy link
Member

slint commented Jan 13, 2020

Since it's not sure if more changes are coming, I've made the webpack-fixes WIP branch in invenio-assets, which can be checked out and contains part of the changes (specifically steps 3 and 5)

@ppanero
Copy link
Member Author

ppanero commented Jan 14, 2020

@slint Thanks! I added a comment here: inveniosoftware/invenio-assets@094c1ef

The most problematic might be point 4.

followSymlinks was added on watchpack (see webpack/watchpack#114). However, it is not compatible with webpack 4 (it cannot be set from there) and as stated here webpack/webpack#6845 it will come with webpack 5...

While searching for the option I did not find it. So I guess it is fixed somehow different in webpack 5 (I'll keep investigating)

Thoughts?

@zzacharo
Copy link
Member

zzacharo commented Feb 3, 2020

For making it work on macos I had to change unfortunately another line in the DirectoryWatcher.js:

function DirectoryWatcher(directoryPath, options) {
        ...
	this.watcher = chokidar.watch(directoryPath, {
                ...
		followSymlinks: true,
                 depth: 1,

Seems that on macos if you don't increase the depth of the traversed subdirectories changes are not detected. I have opened a ticket webpack/watchpack#141 to understand if this is something is known and fixed in the latest beta version.

@lnielsen
Copy link
Member

lnielsen commented Feb 14, 2020

Isn't this solved by #59 ?

@lnielsen lnielsen added this to To do in InvenioRDM February Board via automation Feb 14, 2020
@zzacharo
Copy link
Member

@lnielsen if we move the information on how to you can make webpack work locally in another issue this one can be closed! I will create an issue and I will close it!

@zzacharo
Copy link
Member

Created this #65 out of the information here!

InvenioRDM January Board automation moved this from Blocked to Done Feb 14, 2020
InvenioRDM February Board automation moved this from To do to Done Feb 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

No branches or pull requests

4 participants