init
This commit is contained in:
commit
d667e7d225
25
.eslintrc.json
Normal file
25
.eslintrc.json
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"browser": true,
|
||||||
|
"commonjs": true,
|
||||||
|
"es6": true,
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"parserOptions": {
|
||||||
|
"ecmaVersion": 8,
|
||||||
|
"ecmaFeatures": {
|
||||||
|
"jsx": true
|
||||||
|
},
|
||||||
|
"sourceType": "module"
|
||||||
|
},
|
||||||
|
"rules": {
|
||||||
|
"no-const-assign": "warn",
|
||||||
|
"no-this-before-super": "warn",
|
||||||
|
"no-undef": "warn",
|
||||||
|
"no-unreachable": "warn",
|
||||||
|
"no-unused-vars": "warn",
|
||||||
|
"constructor-super": "warn",
|
||||||
|
"valid-typeof": "warn",
|
||||||
|
"semi": [2, "always"]
|
||||||
|
}
|
||||||
|
}
|
||||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
node_modules/*
|
||||||
20
Readme.md
Normal file
20
Readme.md
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# parcel-plugin-riot
|
||||||
|
|
||||||
|
A parcel plugin for riot.js
|
||||||
|
|
||||||
|
## Using
|
||||||
|
Add parcel-plugin-riot to your project.
|
||||||
|
```
|
||||||
|
npm i parcel-plugin-riot
|
||||||
|
```
|
||||||
|
|
||||||
|
-> You are ready!
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
|
||||||
|
const riot = require('riot')
|
||||||
|
require('./src/App.tag')
|
||||||
|
|
||||||
|
riot.mount('*')
|
||||||
|
```
|
||||||
|
|
||||||
18
RiotAsset.js
Normal file
18
RiotAsset.js
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
const { compile } = require('riot-compiler');
|
||||||
|
const JSAsset = require('parcel-bundler/src/assets/JSAsset');
|
||||||
|
const preamble = "const riot = require('riot');\n";
|
||||||
|
|
||||||
|
class RiotAsset extends JSAsset {
|
||||||
|
|
||||||
|
async parse(inputCode) {
|
||||||
|
const riotOpts = {};
|
||||||
|
|
||||||
|
let code = compile(inputCode, riotOpts, this.name);
|
||||||
|
code = `${ preamble }${ code }`;
|
||||||
|
this.contents = code;
|
||||||
|
|
||||||
|
return super.parse(this.contents);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = RiotAsset;
|
||||||
3
index.js
Normal file
3
index.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module.exports = function (bundler) {
|
||||||
|
bundler.addAssetType('tag', require.resolve('./RiotAsset'));
|
||||||
|
};
|
||||||
6360
package-lock.json
generated
Normal file
6360
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
19
package.json
Normal file
19
package.json
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{
|
||||||
|
"name": "parcel-plugin-riot",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "A parcel plugin for riot.js",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
|
||||||
|
},
|
||||||
|
"author": {
|
||||||
|
"name": "andruschka",
|
||||||
|
"url": "https://92digital.com"
|
||||||
|
},
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"parcel-bundler": "^1.4.1",
|
||||||
|
"riot": "^3.8.1",
|
||||||
|
"riot-compiler": "^3.4.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user