gulp-vue-module
Gulp plugin for Vue.js *.vue
component file complie to AMD / CMD / CommonJS module.
Now, You can use Require.js / Sea.js ... etc. Front-end Module loader load Vue Component, not use Webpack and vue-loader.
Usage
$ npm install gulp-vue-module --save-dev
Gulpfile.js
:
var fs = ;var path = ;var gulp = ;var rename = ;var VueModule = ; gulp; gulp;
app.vue
:
tag order :
<style>
><template>
><script>
,<tempate>
tag must be at<script>
tag before.
{{a}}
<template>
tag unsupport set lang attribute, support setinclude="/path/to/xxx.xxx"
attribute.
<script>
tag unsupport set lang attribute, so you can't use ES6 syntax;
<style>
tag support setlang="css|scss|sass"
attribute, and support sethref="/path/to/xxx.(css|scss|sass)"
attribute link CSS file.You can use
<header-comment>
tag insert the header comments
Output :
require.loadCSS()
implement example :
require { var head = document0; if configcontent var style = document; styletype = 'text/css'; if stylestyleSheet // for IE stylestyleSheetcssText = configcontent; else styleinnerHTML = configcontent; head; ; else if configurl var link = document; linkhref = configurl; linkrel = 'stylesheet'; linktype = 'text/css'; head; };
Options
debug : false // Debug mode amd : false // AMD style, Define module name and deps define : true // Using define() wrapper the module, false for Node.js (CommonJS style) defineName : false // Define the module name indent : ' ' // Indent whitespace headerComment : true // Using <header-comment> Insert the header comments templateReplaceTag : '__template__' // vue component template replace tag loadCSSMethod : 'require.loadCSS' // define the load css method for require
Changes
License
The MIT license.
Copyright (C) 2016 Pandao