
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
vue-scriptx
Advanced tools
VueScriptX brings back the <script> tag to your Vue projects!
This package is inspired by vue-script2.
This tiny package should take care of all your declarative and imperative asynchronous loading needs. Nothing too complicated from what web devs already know.
This version is tailored for the Vue.js framework, but it's easy to port to others.
If you like this package, a star to the repo is nice.
<script> tag to your Vue projects as <scriptx>.$scriptx for regular code access.async prop.unload handles callbacks after script being unmounted.npm install vue-scriptx --save
Then enable the plugin (in your main.ts or wherever):
import App from '../App.vue'
import ScriptX from 'vue-scriptx'
createApp(App)
.use(ScriptX)
As simple as using <scriptx> as <script> tags or using this.$scriptx, below samples illustrates how to load jQuery asynchronously.
DO NOT put user provided code inside <scriptx> or its propeties.
By default, <scriptx> tags are serialized using promises so that one script loads after another has finished. If you don't need ordered execution, add async to have the script injected immediately.
The scriptx component takes text as slot, you can still use delimiters to change the text being sent as slot.
<scriptx src="/path/to/jquery.min.js"></scriptx>
<scriptx>
$('#msg').text('Hello from VueScriptX!')
</scriptx>
asyncSpecify if this script should load itself asynchronously (ignoring execution order of other scripts). This defaults to "false".
You can also mix them so that some <scriptx> tags are loaded asynchronously while others wait for the ones before them.
<scriptx src="jquery.min.js"></scriptx>
<scriptx>$('#foo').text('hi!')</scriptx>
<!-- Load next script immediately, don't wait for jQuery -->
<scriptx src="lib.js" async></scriptx>
unloadCallback being executed after the scriptx is being unmounted. Note that it takes a string containing the code.
<scriptx src="/path/to/jquery.min.js" unload="jQuery.noConflict(true)"></scriptx>
It may not work in typescript as it may complain that $ is undefined.
this.$scriptx.load('/path/to/jquery.min.js')
.then(() => $('#msg').text('Hello from VueScriptX!'))
Contributions are welcomed, as long as it doesn't cause any harm to any users.
Please do not submit compiled files (e.g. the dist directory of this repo).
FAQs
VueScriptX brings back the <script> tag to your Vue projects!
We found that vue-scriptx demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.