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

vue-toolchain

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-toolchain

Simplified toolchain for Vue development

  • 0.8.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
8
decreased by-79.49%
Maintainers
1
Weekly downloads
 
Created
Source

vue-toolchain

This is a small suite of tools for bundling and testing a Vue project. Its main advantages over vue-loader and others is:

  • Ability to load and test .vue files in Node
  • A Webpack loader that produces less output, and
  • A Gulp utility for integrating <style> into your Gulp pipeline.

vue-toolchain/register

Example (change register.js to vue-toolchain/register)

You can use this with Mocha to launch tests that require Vue files. Say you have some tests, Button.spec.js for Button.vue. Assume Button.spec.js looks like this:

const Button = require('./Button.vue').default;
const Vue = require('vue');
const vm = new Vue(Button);

vm.text = 'Click Me!';
vm.$mount();

expect(vm._vnode.children[0].text).toBe('Click me!')

You can use vue-toolchain to run the tests in Node like this:

$ mocha -r vue-toolchain/register Button.spec.js

vue-toolchain/loader

Example

Use the loader like any Webpack loader. Sourcemaps are supported, but many of the vue-loader features like HMR are not yet supported. Stripping out CSS is specifically not supported because of a preference to use Gulp for styles (more on that below).

module.exports = {
  module: {
    rules: [
      {test: /\.vue$/, use: 'vue-toolchain/loader'}
    ]
  }
};

One benefit of using vue-toolchain's loader is that unlike the upstream vue-loader, it does not use a combination of 3 Webpack loaders and 3 JS modules for one component. vue-toolchain's loader uses an alternate approach: using Babel, modify the AST of the component to add the render function. In large applications, this can save you tens of kilobytes.

vue-toolchain/gulp-vue-to-style-stream

Example

You can pipe the .vue files through this Gulp util in order to get styles out. Doing it this way allows you to have variables defined in other SCSS files which you can then use in your component <style>. (If you do want to use variables, just make sure they concatenate in the right order - see the demo for how).

const gulp = require('gulp');
const vueToStyle = require('vue-toolchain/gulp-vue-to-style-stream');
const scss = require('gulp-sass');
const concat = require('gulp-concat');

gulp.task('scss', () => {
  gulp.src('*.vue')
    .pipe(vueToStyle())
    .pipe(concat('styles.scss'))
    .pipe(scss())
    .pipe(gulp.dest('.'));
});

FAQs

Package last updated on 16 Feb 2023

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