commit | 5cae239090db88bc54b31dd8910d651cf59258db | [log] [tgz] |
---|---|---|
author | 弘树 <dickeylth@users.noreply.github.com> | Wed Aug 17 14:53:43 2016 +0800 |
committer | GitHub <noreply@github.com> | Wed Aug 17 14:53:43 2016 +0800 |
tree | e08620068371eb531080c8832679eaf8ca521c07 | |
parent | 5c394099bfb984d42b1435b98000cf1b8b80e17b [diff] |
`parse5` should be in dependencies https://github.com/weexteam/weex-loader/blob/dev/src/parser.js#L1
A webpack loader for Weex.
npm install weex-loader@0.3.0-alpha babel-loader babel-preset-es2015 babel-runtime babel-plugin-transform-runtime --save
.we
file..js/.css/.html
) via src
attribute..we
file..we
file.make a webpack config
module.exports = { entry: './main.we?entry', output: { path: './dist', filename: 'main.js' }, module: { loaders: [ { test: /\.we(\?[^?]+)?$/, loader: 'weex' } ] } };
specify src
attribute
<template src="./main.html"></template> <style src="./main.css"></style> <script src="./main.js"></script>
append a weex config in webpack config
weex: { lang: { jade: ['jade-html'] // a jade langauge will chain "jade-html-loader" } }
main.we
<template lang="jade"> div text Hello Weex </template>
.we
file as component elementpath/to/component.we
in script
like require('./foo.we')
or write inline element like <element name="foo" src="./foo.we"></element>
.template
like <foo></foo>
.<element name="foo" src="./foo.we"></element> <template> <div> <foo></foo> <bar></bar> </div> </template> <script> require('./bar.we') </script>
require('./foo.we?name="fooo"')
. Or specify a name attribute in element, like <element name="fooo" src="./foo.we" ></element>
template
like <fooo></fooo>
.<element name="fooo" src="./foo.we"></element> <template> <div> <fooo></fooo> <baar></baar> </div> </template> <script> require('./bar.we?name=baar') </script>
npm run test
will run mocha testing.
And you can check the specs in test/spec
folder.
src
attrBug
Source Map Offset. Encoding to this problem, please use devtool:"eval-source-map"
instead of devtool:"source-map"
.Bug
Can't set debugger breakpoint. I still don't know the reason, but you can debug with debugger
keyword.