
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
Brue allows you to express Vue templating in 100% vanilla javascript resulting in more concise components. Brue componants are indistinguishable from Vue componants and can be used interchangably. Now re-written specifically for Vue 3.x.
Brue allows you to express Vue templating in 100% vanilla javascript resulting in more concise components. Brue componants are indistinguishable from Vue componants and can be used interchangably. Now re-written specifically for Vue 3.x.
with Brue:
import Brue from 'brue';
import { reactive } from 'vue';
import CustomComponent from './CustomComponent.vue'
export default Brue('incomingProp', props => {
const state = reactive({
double: props.incomingProp * 2
})
const doClick = () => console.log('click');
return $ => { $
.a('div .example')
.b('h1').text('Twice as much')
.b(CustomComponent, { customProp: true })
.b('div .link').text(state.double)
.click(doClick)
}
});
with Vue:
<template>
<div class="example">
<h1>Twice as much</h1>
<custom-component :customProp="true" />
<div class="link" @click="doClick">
{{ state.double }}
</div>
</div>
</template>
<script>
import { reactive } from 'vue';
import CustomComponent from './CustomComponent.vue'
export default {
props: ['incomingProp'],
components: {
CustomComponent
},
setup(props){
const state = reactive({
double: props.incomingProp * 2
})
const doClick = () => console.log('click');
return {
state,
doClick
}
}
}
</script>
Brue() accepts the component properties followed by the setup function. The property names can be spread across the arguments or as a single object or array - Brue expects the setup function to be the last argument. If a property is not specified it will be treated like an HTML attribute.
//Any of these work...
Brue('prop1','prop2', props => {
});
Brue(['prop1','prop2'], (props, context) => {
});
Brue(
{
prop1: String,
prop2: Number
},
(props, { slots, attrs, emit}) => {
// ...
}
);
The component function passed to Brue needs to return a render function. The first argument of the render function (the tree builder variable $) is used to construct the virtual DOM node tree. Every $ function returns $, allowing for continuous chaining. The chain can be suspended to perform loops or execute javascript and then reestablished with $.
E.g.
$ => { $
.a('ul')
users.map(user => { $
.b('li').key(user.id)
.c('span').text(user.name)
});
}
.a(), .b(), .c(), etc. (through z) are used to establish a new node (html tag or component), and establish the child-parent relationship. c nodes are children of b nodes, etc.
Strings
Strings passed into nodes as arguments can define the element type, class, and/or id of the node:
$
.a('div')
.b('h1 .headerClass #homeHeader').text('Home')
//same as
.a('div')
.b('h1','#homeHeader', {class: 'headerClass'}).text('Home')
Objects
Objects passed into nodes as arguments will define properties and/or attributes. There's no need to use v-bind - variables and values can be used directly. Note Since Vue components are objects: if the first argument is an object, Brue will assume you're defining the node type as a vue component.
$
.a('div')
.b(MyComponent, {someProp: true, title: 'Example attribute'})
Node modifiers are $ functions that can further define characteristics of a node. Any non-alphabet $ function will always modify the last established node.
$
.a('div')
.style({fontSize: '14px'})
.on('click', doSomething)
Text nodes can be defined a number of ways:
// all equivalent:
$.a('div').text('')
$.a('div')
.b().text('Hello')
$.a('div')
.b(String, 'Hello')
The .b(String, 'Hello') format can make it a little easier to express inline tags (not a Brue strong point):
// <div>Inline <em>tags</em> are a bit verbose</div>
$
.a('div')
.b(String, 'Inline ')
.b('em').text('tags')
.b(String, ' are a bit verbose')
More to come.
Assign classes to the node based on boolean values. The equivalent of v-bind:class.
.a('div .mynode').class({
active: true,
deleted: false
})
// <div class="mynode active"></div>
Set the contents of the node to pre formatted html. Equivalent to innerHTML. Any inner children or text nodes will be igonored.
Within a loop specify a unique key to optimize rendering. Vue docs: Maintaining State
Add an event listener to the node. Accepts either a single listener or an object of listeners. In addition, event modifiers can be added as suffixes (event.mod) or as optional arguments.
Some examples:
$.a('div')
.on('click', doClick)
//
$.a('div')
.on({
'focus': () => console.log('focus'),
'keydown.ctrl': onCtrlKey
})
//
$.a('div')
.on('contextmenu', rightClickFunc, 'prevent','stop')
Modifiers:
| events | mouse | key values | key mods |
|---|---|---|---|
| stop prevent capture self once passive | left right middle | enter tab delete esc space up down left right | ctrl alt shift meta exact |
Assign a reference to the element. Vue docs: Refs
Assign styles to the node. The equivalent of v-bind:style.
.a('.mynode').style({
color: 'red',
fontSize: '14px'
})
Sets the inner text of the node: .a('p').text('Hello') creates <p>Hello</p>. If the node has any other children, the text will be inserted after the children. Alternatively, use String as the first argument of a node: .a('p').b(String, 'Hello')
FAQs
Brue allows you to express Vue templating in 100% vanilla javascript resulting in more concise components. Brue componants are indistinguishable from Vue componants and can be used interchangably. Now re-written specifically for Vue 3.x.
We found that brue 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
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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.