New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

vue-frag

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-frag

Vue fragment directive to unwrap root elements

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
18K
increased by9.26%
Maintainers
1
Weekly downloads
 
Created
Source

vue-frag

Vue 2 fragment directive to unwrap root elements

🙋‍♂️ Why?

  • 🔥 Multiple root nodes Without creating a functional component!
  • ⭐️ SSR Unwraps the root element on client-side post-hydration!
  • 🐥 Tiny Only 277 B!

🚀 Install

npm i vue-frag

🚦 Quick Setup

Register globally

Make it available anywhere in your Vue application.

import frag from 'vue-frag';
Vue.directive('frag', frag);
Register locally

Explicitly register it to a component you want to use it in.

...

<script>
import frag from 'vue-frag';

export default {
    directives: {
        frag
    },

    ...
};
</script>

👨🏻‍🏫 Examples

Returning multiple root nodes
<template>
    <div #frag> <!-- This element will be unwrapped -->

        <div v-for="i in 10">
            {{ i }}
        </div>
    </div>
</template>
Unwrapping the root node from a component
<template>
    <div>
        <some-custom-component #frag />
    </div>
</template>

Keywords

FAQs

Package last updated on 08 Sep 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc