├── tests ├── vue │ ├── link-css.vue │ ├── template-include.vue │ ├── link-sass.vue │ ├── link-scss.vue │ ├── sass.vue │ ├── scss.vue │ ├── include.vue │ ├── list.vue │ ├── exports.vue │ └── app.vue ├── template │ └── test.html ├── dist │ ├── link-css.js │ ├── sass.js │ ├── template-include.js │ ├── scss.js │ ├── link-scss.js │ ├── link-sass.js │ ├── include.js │ ├── list.js │ ├── exports.js │ └── app.js ├── package.json ├── scss │ └── test.scss ├── sass │ └── test.sass └── Gulpfile.js ├── .npmignore ├── CHANGE.md ├── .gitignore ├── package.json ├── LICENSE ├── README.md └── index.js /tests/vue/link-css.vue: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/vue/template-include.vue: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/vue/link-sass.vue: -------------------------------------------------------------------------------- 1 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /tests/vue/link-scss.vue: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /tests/template/test.html: -------------------------------------------------------------------------------- 1 |
2 |

'NAME': {{name}}

3 | 4 |
-------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .*.swp 2 | ._* 3 | .DS_Store 4 | .git 5 | .hg 6 | .npmrc 7 | .lock-wscript 8 | .svn 9 | .wafpickle-* 10 | config.gypi 11 | CVS 12 | npm-debug.log 13 | tests 14 | backup -------------------------------------------------------------------------------- /tests/dist/link-css.js: -------------------------------------------------------------------------------- 1 | define(function(require, exports, module) { 2 | require.loadCSS({url : "./css/test.css"}); 3 | 4 | module.exports = { 5 | template : '' 6 | }; 7 | }); -------------------------------------------------------------------------------- /tests/dist/sass.js: -------------------------------------------------------------------------------- 1 | define(function(require, exports, module) { 2 | require.loadCSS({content : "body{font:100% Helvetica,sans-serif;color:#333}"}); 3 | 4 | module.exports = { 5 | template : '' 6 | }; 7 | }); -------------------------------------------------------------------------------- /tests/dist/template-include.js: -------------------------------------------------------------------------------- 1 | define(function(require, exports, module) { 2 | module.exports = { 3 | template : '

'NAME': {{name}}

' 4 | }; 5 | }); -------------------------------------------------------------------------------- /tests/vue/sass.vue: -------------------------------------------------------------------------------- 1 | 3 | 4 | 13 | 14 | -------------------------------------------------------------------------------- /tests/dist/scss.js: -------------------------------------------------------------------------------- 1 | define(function(require, exports, module) { 2 | require.loadCSS({content : ".card{backround:red}.card>.head{color:red;background:yellow}"}); 3 | 4 | module.exports = { 5 | template : '
Header
' 6 | }; 7 | }); -------------------------------------------------------------------------------- /CHANGE.md: -------------------------------------------------------------------------------- 1 | ## v0.1.x 2 | 3 | ### v0.1.3 4 | 5 | - Added: `externalRequire` option for `define()` parameters use Require.js config modules. 6 | 7 | ### v0.1.2 8 | 9 | - fixed ` 19 | 20 | -------------------------------------------------------------------------------- /tests/dist/link-sass.js: -------------------------------------------------------------------------------- 1 | define(function(require, exports, module) { 2 | require.loadCSS({content : "html,body,ul,ol{margin:0;padding:0}body{font:100% Helvetica,sans-serif;color:#333}nav ul{margin:0;padding:0;list-style:none}nav li{display:inline-block}nav a{display:block;padding:6px 12px;text-decoration:none}"}); 3 | 4 | module.exports = { 5 | template : '' 6 | }; 7 | }); -------------------------------------------------------------------------------- /tests/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gulp-vue-module-tests", 3 | "version": "0.1.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "Pandao", 10 | "license": "MIT", 11 | "devDependencies": { 12 | "gulp": "^3.9.1", 13 | "gulp-rename": "^1.2.2" 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/scss/test.scss: -------------------------------------------------------------------------------- 1 | $font-stack: Helvetica, sans-serif; 2 | $primary-color: #333; 3 | 4 | body { 5 | font: 100% $font-stack; 6 | color: $primary-color; 7 | } 8 | 9 | nav { 10 | ul { 11 | margin: 0; 12 | padding: 0; 13 | list-style: none; 14 | } 15 | 16 | li { display: inline-block; } 17 | 18 | a { 19 | display: block; 20 | padding: 6px 12px; 21 | text-decoration: none; 22 | } 23 | } -------------------------------------------------------------------------------- /tests/dist/include.js: -------------------------------------------------------------------------------- 1 | define(function(require, exports, module) { 2 | var a = require("a"); 3 | var Vue = require("vue"); 4 | module.exports = Vue.component("xxx", {, 5 | template : '#include "./tpl/test.html"', 6 | data : function() { 7 | return { 8 | a : 23456 9 | } 10 | }, 11 | props : ["msg"], 12 | components: { 13 | aaa : a 14 | } 15 | }); 16 | }); -------------------------------------------------------------------------------- /tests/sass/test.sass: -------------------------------------------------------------------------------- 1 | html, 2 | body, 3 | ul, 4 | ol 5 | margin: 0 6 | padding: 0 7 | 8 | 9 | $font-stack: Helvetica, sans-serif 10 | $primary-color: #333 11 | 12 | body 13 | font: 100% $font-stack 14 | color: $primary-color 15 | 16 | nav 17 | ul 18 | margin: 0 19 | padding: 0 20 | list-style: none 21 | 22 | li 23 | display: inline-block 24 | 25 | a 26 | display: block 27 | padding: 6px 12px 28 | text-decoration: none 29 | -------------------------------------------------------------------------------- /tests/vue/include.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /tests/dist/list.js: -------------------------------------------------------------------------------- 1 | define(function(require, exports, module) { 2 | require.loadCSS({url : "./css/test.css"}); 3 | 4 | var a = require("a"); 5 | var Vue = require("vue"); 6 | module.exports = Vue.component("xxx", { 7 | data : function() { 8 | return { 9 | a : 23456 10 | } 11 | }, 12 | template : '
{{a}}'dfsadf'
', 13 | props : ["msg"], 14 | components: { 15 | aaa : a 16 | } 17 | }); 18 | }); -------------------------------------------------------------------------------- /tests/vue/list.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 25 | 26 | -------------------------------------------------------------------------------- /tests/dist/exports.js: -------------------------------------------------------------------------------- 1 | define(function(require, exports, module) { 2 | var Vue = require("vue"); 3 | exports.a = Vue.extend({ 4 | data : function() { 5 | return { 6 | name : "Vue.js" 7 | } 8 | }, 9 | template : '
{{name}}
' 10 | }); 11 | exports.b = Vue.extend({ 12 | template : '
{{name}}
' 13 | }); 14 | exports.b = Vue.extend({ 15 | template : '
{{name}}
' 16 | }); 17 | exports.d = Vue.extend({ 18 | template : '
{{name}}
' 19 | }); 20 | }); -------------------------------------------------------------------------------- /tests/vue/exports.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | 6 | # Runtime data 7 | pids 8 | *.pid 9 | *.seed 10 | 11 | # Directory for instrumented libs generated by jscoverage/JSCover 12 | lib-cov 13 | 14 | # Coverage directory used by tools like istanbul 15 | coverage 16 | 17 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 18 | .grunt 19 | 20 | # node-waf configuration 21 | .lock-wscript 22 | 23 | # Compiled binary addons (http://nodejs.org/api/addons.html) 24 | build/Release 25 | 26 | # Dependency directory 27 | node_modules 28 | 29 | # Optional npm cache directory 30 | .npm 31 | 32 | # Optional REPL history 33 | .node_repl_history 34 | 35 | # Directory 36 | backup 37 | temp 38 | tests/node_modules 39 | .vscode 40 | .idea -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gulp-vue-module", 3 | "version": "0.1.3", 4 | "homepage": "https://github.com/pandao/gulp-vue-module", 5 | "description": "Gulp plugin for Vue.js `*.vue` component file complie to AMD / CMD / CommonJS module.", 6 | "main": "index.js", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1" 9 | }, 10 | "keywords": [ 11 | "vue", 12 | "amd", 13 | "module", 14 | "component", 15 | "gulpplugin" 16 | ], 17 | "repository": { 18 | "type": "git", 19 | "url": "git://github.com/pandao/gulp-vue-module.git" 20 | }, 21 | "author": "Pandao", 22 | "license": "MIT", 23 | "dependencies": { 24 | "gulp-util": "^3.0.7", 25 | "node-sass": "^4.7.2", 26 | "parse5": "^2.1.5", 27 | "through2": "^2.0.1" 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /tests/dist/app.js: -------------------------------------------------------------------------------- 1 | //@moduleName app 2 | //@moduleDeps a,b, vue/all 3 | define("app", ["vue/all", "component/list"], function(require, exports, module) { 4 | require.loadCSS({content : "/*fdsafsdf*/.app {background:red;color:#fff;padding:10px;}.app span {font-size: 18px;}"}); 5 | 6 | // indent 4 7 | var Vue = require("vue/all"); 8 | var listComponent = require('component/list'); 9 | module.exports = Vue.extend({ 10 | data : function() { 11 | return { 12 | a : 23456 13 | } 14 | }, 15 | methods : { 16 | click : function() { 17 | console.log("click()"); 18 | } 19 | }, 20 | components: { 21 | 'list-component' : listComponent 22 | }, 23 | template : '

{{a}}'ABC'

' 24 | }); 25 | }); -------------------------------------------------------------------------------- /tests/Gulpfile.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | var path = require('path'); 3 | var gulp = require('gulp'); 4 | var rename = require('gulp-rename'); 5 | var VueModule = require('../index.js'); 6 | 7 | gulp.task('vue', function() { 8 | return gulp.src('./vue/**/*.vue') 9 | .pipe(VueModule({ 10 | debug : true, 11 | //define : false, // Default true, Using define wrapper module, false for Node.js (CommonJS style) 12 | amd : true, // Default false, AMD style, define module name and deps 13 | defineName : true, // define module name 14 | //templateReplaceTag : '__template__', // vue component template replace tag 15 | //loadCSSMethod : 'require.css' // define the load css method for require 16 | })) 17 | .pipe(rename({extname : ".js"})) 18 | .pipe(gulp.dest("./dist")); 19 | }); 20 | 21 | gulp.task('default', ['vue']); -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 pandao 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /tests/vue/app.vue: -------------------------------------------------------------------------------- 1 | 2 | //@moduleName app 3 | //@moduleDeps a,b, vue/all 4 | 5 | 6 | 13 | 14 | 39 | 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # gulp-vue-module 2 | 3 | Gulp plugin for [Vue.js](https://github.com/vuejs/vue) `*.vue` component file complie to AMD / CMD / CommonJS module. 4 | 5 | Now, You can use [Require.js](https://github.com/requirejs/requirejs) / [Sea.js](https://github.com/seajs/seajs) ... etc. Front-end Module loader load Vue Component, not use [Webpack](http://webpack.github.io/) and [vue-loader](https://github.com/vuejs/vue-loader). 6 | 7 | ### Usage 8 | 9 | ```shell 10 | $ npm install gulp-vue-module --save-dev 11 | ``` 12 | 13 | `Gulpfile.js` : 14 | 15 | ```javascript 16 | var fs = require('fs'); 17 | var path = require('path'); 18 | var gulp = require('gulp'); 19 | var rename = require('gulp-rename'); 20 | var VueModule = require('gulp-vue-module'); 21 | 22 | gulp.task('vue', function() { 23 | return gulp.src('./vue/**/*.vue') 24 | .pipe(VueModule({ 25 | debug : true 26 | })) 27 | .pipe(rename({extname : ".js"})) 28 | .pipe(gulp.dest("./dist")); 29 | }); 30 | 31 | gulp.task('default', ['vue']); 32 | ``` 33 | 34 | `app.vue` : 35 | 36 | > tag order : ` 51 | 52 | 58 | 59 | 81 | ``` 82 | > `