Vue cli context

Sampily to get the Packages in Directory

Version: 1.4.6 Updated: 01/14/2020

By: joenix License: MIT

Downloads Last 30 Days: 97

Install

npm i vue-cli-context
yarn add vue-cli-context

CDNs

bundle.run: https://bundle.run/vue-cli-context

jsDelivr: https://cdn.jsdelivr.net/npm/vue-cli-context

unpkg: https://unpkg.com/vue-cli-context

vue-cli-context

Sampily to get the Packages in Directory

npm i vue-cli-context
# or
yarn add vue-cli-context
import contextual from "vue-cli-context";

contextual({
  // context
  context: require.context(
    // directory
    `@/pages/`
    // recursive
    true,
    // regular
    /.js$/
  ),
  // expect
  expect: pkg => pkg
  // if need some injections, it must be export a function within the file
  inject: {
    say: `hello world`
  }
}).then( pkgs => console.log(pkgs));
// sample package with option: `inject`
export default ({ say }) => {
  console.log(say);
  // each package must set propert: `name`
  return {
    name: `sample`
  };
};

Contributors



joenix
commits

Dependencies


DevDependencies


Categories: Vue js
Tags: