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

T281510 Serve plugin assets individually (unbundled) #7

Closed
wants to merge 17 commits into from

Conversation

hueitan
Copy link
Member

@hueitan hueitan commented May 4, 2021

Phabricator Ticket : https://phabricator.wikimedia.org/T281510

Step by Step

  • Add Wikipedia Preview as the submodule
  • Execute npm bun build in the submodule
  • Moving js and images assets from Wikipedia-Preview into folder assets
  • Update latest Wikipedia Preview version

@hueitan
Copy link
Member Author

hueitan commented May 5, 2021

Okay, the current bash script works now. You can check out by just npm i then you have everything.

The only leftover thing is reworking the bash script to make it looks more professional. at the same time, you can review it.

scripts/postinstall.sh Outdated Show resolved Hide resolved
wikipediapreview-wordpress.php Outdated Show resolved Hide resolved
scripts/postinstall.sh Outdated Show resolved Hide resolved
@stephanebisson
Copy link
Contributor

The script doesn't work for me. There's no content in the submodule. What do I need to do?

@hueitan
Copy link
Member Author

hueitan commented May 6, 2021

Ok, it should work now in one command npm i

@hueitan hueitan marked this pull request as ready for review May 6, 2021 11:27
@hueitan hueitan requested review from medied and stephanebisson May 6, 2021 11:27
Copy link
Contributor

@stephanebisson stephanebisson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't really work for me. The images are always embedded.

.gitignore Outdated Show resolved Hide resolved
scripts/postinstall.sh Outdated Show resolved Hide resolved
wikipediapreview-wordpress.php Outdated Show resolved Hide resolved
wikipediapreview-wordpress.php Outdated Show resolved Hide resolved
@hueitan
Copy link
Member Author

hueitan commented May 10, 2021

This PR will require another update to replace most of the bash script (compiled js and css part) after this wikimedia/wikipedia-preview#113 is done.

scripts/postinstall.sh Outdated Show resolved Hide resolved
cd wikipedia-preview
git reset --hard
npm i
EXTERNAL_IMAGE_PATH='/wp-content/plugins/wikipediapreview-wordpress/assets/images' npm run build
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This path is problematic. Different setups can have different url structures. Plugins are expected to call php functions to get info like this.

A simple way to work around that is to put the images dir under the styles dir and use urls like images/xxx.svg. However, since we don't include the style as a file but as an inline <style> tag created by js, the style relative path is the document, which is close to the root, far away from the plugins.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense, the update is here 2d46a13

@hueitan
Copy link
Member Author

hueitan commented Jan 10, 2024

partially done in #101, reopen this ticket if needed.

@hueitan hueitan closed this Jan 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants