file2variable-cli
A CLI tool to read file content and assign it to a variable
Last updated a year ago by plantain_00 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install file2variable-cli 
SYNC missed versions from official npm registry.

file2variable-cli

Dependency Status devDependency Status Build Status: Linux Build Status: Windows npm version Downloads

A CLI tool to read file content and assign it to a variable

features

  • file content as string variable (*)
  • json file content as object variable (*.json --json)
  • protobuf file content as object variable (*.proto --protobuf)
  • html file minified (*.html --html-minify)
  • vue template precompile (* --vue --vue-type-name "App" --vue-type-path "./index")

install

npm i file2variable-cli

usage

file2variable-cli demo/*.html demo/*.json demo/*.proto -o demo/variables.js --html-minify --json --protobuf --vue --base demo

file2variable-cli demo/*.html demo/*.json demo/*.proto -o demo/variables.js --html-minify --json --protobuf --vue --base demo --watch

config file

file2variable-cli --config demo/file2variable.config.js

module.exports = {
  base: 'demo',
  files: [
    'demo/*.txt',
    'demo/*.html',
    'demo/*.json',
    'demo/*.proto'
  ],
  /**
   * @argument {string} file
   */
  handler: file => {
    if (file.endsWith('foo.html')) {
      return {
        type: 'vue',
        name: 'App',
        path: './index'
      }
    }
    if (file.endsWith('bar.html')) {
      return {
        type: 'vue'
      }
    }
    if (file.endsWith('baz.html')) {
      return { type: 'html-minify' }
    }
    if (file.endsWith('.json')) {
      return { type: 'json' }
    }
    if (file.endsWith('.proto')) {
      return { type: 'protobuf' }
    }
    return { type: 'text' }
  },
  out: 'demo/variables.ts'
}

Current Tags

  • 1.8.5                                ...           latest (a year ago)

24 Versions

  • 1.8.5                                ...           a year ago
  • 1.8.4                                ...           a year ago
  • 1.8.3                                ...           a year ago
  • 1.8.2                                ...           a year ago
  • 1.8.1                                ...           a year ago
  • 1.8.0                                ...           a year ago
  • 1.7.5                                ...           a year ago
  • 1.7.4                                ...           a year ago
  • 1.7.3                                ...           a year ago
  • 1.7.2                                ...           a year ago
  • 1.7.1                                ...           a year ago
  • 1.7.0                                ...           a year ago
  • 1.6.0                                ...           2 years ago
  • 1.5.4                                ...           2 years ago
  • 1.5.2                                ...           2 years ago
  • 1.5.1                                ...           2 years ago
  • 1.5.0                                ...           2 years ago
  • 1.4.1                                ...           2 years ago
  • 1.4.0                                ...           2 years ago
  • 1.3.0                                ...           2 years ago
  • 1.2.1                                ...           2 years ago
  • 1.2.0                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 24
This Month 25
Last Day 24
Last Week 0
Last Month 29
Dependencies (10)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |