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

Added the easiest way to defer all script tags #19

Merged
merged 1 commit into from Apr 7, 2019

Conversation

Projects
None yet
1 participant
@shinsenter
Copy link
Owner

commented Apr 7, 2019

The easiest way to defer JavaScript

GitHub Release Date npm npm bundle size jsDelivr hits (GitHub)

The easiest way to delay the execution of the existing <script> tags on your site is to modify the type attribute of the tag to deferjs (except the one which contains defer_plus.min.js or defer.min.js).

For example: if we have 2 script tags like this.

<script type="text/javascript">/* my inline script */</script>
<script type="text/javascript" src="path/to/my/script.js"></script>

Just change type="text/javascript" to type="deferjs", like this:

<script type="deferjs">/* my inline script */</script>
<script type="deferjs" src="path/to/my/script.js"></script>

Note: This method can only be used since version 1.1.5.

@shinsenter shinsenter merged commit b53ca2a into master Apr 7, 2019

1 check passed

CodeFactor No issues found.
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.