Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add rel="preload" option for JS/CSS #203

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

Merged
joaopslins merged 5 commits into django-webpack:master from pglotov:isPreload
Aug 23, 2021

Conversation

@pglotov
Copy link

@pglotov pglotov commented Aug 9, 2019
edited
Loading

Added an option to specify css file with rel="preload":

{% render_bundle 'commons' 'css' is_preload=True %}

It renders to

<link type="text/css" href="/static/dist/commons-ce3c39c62a45f3d1d496.bundle.css" rel="preload" as="style">

mathijsmeulendijks, memory-lovers, bilelmoussaoui, petrprikryl, zenofewords, ihorbryk, etienned, and andruten reacted with thumbs up emoji
@pglotov pglotov changed the title (削除) Add rel="preload" option for css (削除ここまで) (追記) Add rel="preload" option for css (追記ここまで) Aug 9, 2019
@pglotov pglotov force-pushed the isPreload branch 2 times, most recently from 5d1d3ca to f69a02b Compare August 9, 2019 15:03
@fjsj fjsj self-requested a review May 6, 2021 13:19
@fjsj fjsj self-assigned this May 6, 2021
Copy link

Is this exclusive to css? I have a lot of vue apps that would benefit massively from preloading

Copy link

@EthanZeigler I think it works with every kind of bundles.

@fjsj fjsj removed their assignment Jul 15, 2021
Copy link
Contributor

Thanks for the PR! I've also added support for preloading scripted files.

The way I see it, this is the expected way of using this. Let me know if that makes sense:

{% load render_bundle from webpack_loader %}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Example</title>
{% render_bundle 'main' 'css' is_preload=True %}
{% render_bundle 'main' 'js' is_preload=True %}
{% render_bundle 'main' 'css' %}
</head>
<body>
{% render_bundle 'main' 'js' %}
</body>
</html>

@rvlb I think this deserves a section in the README. Let me know if you are able to do it, or how I can help with this.

andruten and rvlb reacted with thumbs up emoji

@rvlb rvlb assigned joaopslins and unassigned rvlb Aug 19, 2021
@rvlb rvlb mentioned this pull request Aug 19, 2021
11 tasks
@joaopslins joaopslins changed the title (削除) Add rel="preload" option for css (削除ここまで) (追記) Add rel="preload" option for JS/CSS (追記ここまで) Aug 23, 2021
@joaopslins joaopslins merged commit 5839809 into django-webpack:master Aug 23, 2021
Copy link
Contributor

FYI this was just included in the 1.3.0 version

andruten reacted with hooray emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@rvlb rvlb rvlb approved these changes

@fjsj fjsj Awaiting requested review from fjsj

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /