Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
vagusX authored and vagusX committed Mar 22, 2017
0 parents commit aed4727
Show file tree
Hide file tree
Showing 11 changed files with 233 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# editorconfig.org
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
4 changes: 4 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
extends:
- standard
env:
node: true
38 changes: 38 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
.DS_Store

# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history

dist
11 changes: 11 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.gitignore
.editorconfig

node_modules/
npm-debug.log

dist/
test/

.travis.yml
*.config.js
21 changes: 21 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
sudo: false
language: node_js
cache:
directories:
- node_modules
notifications:
email: false
node_js:
- '6'
before_install:
- npm i -g npm@^3.0.0
before_script:
- npm prune
script:
- npm run build
after_success:
- npm run test
- npm run semantic-release
branches:
only:
- master
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 1.0.0 - 2016-09-23

Initial release
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2016 vagusX

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
22 changes: 22 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import loaderUtils from 'load-utils'

export default function () {}

export function pitch (remainingRequest) {
this.cacheable && this.cacheable()

// console.log(loaderUtils.stringifyRequest(this, '!!' + remainingRequest))

const srcFilepath = this.resourcePath
// const srcDirpath = path.dirname(srcFilepath)
const tmp = `
var link = document.createElement('link')
link.rel = 'import'
link.href = '${srcFilepath}'
document.head.appendChild(link)
`

const result = tmp.replace(/\n\s+/g, ' ')

return result
}
44 changes: 44 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "html-imports-loader",
"description": "",
"main": "dist/html-imports-loader.js",
"jsnext:main": "dist/html-imports-loader.es2015.js",
"scripts": {
"build": "rimraf dist/** && NODE_ENV=production node rollup.config.js",
"build:dev": "node rollup.config.js",
"dev": "npm run build:dev && npm run watch",
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
"watch": "onchange lib -- npm run dev"
},
"repository": {
"type": "git",
"url": "https://github.com/vagusX/html-imports-loader.git"
},
"config": {
"ghooks": {
"commit-msg": "node ./node_modules/.bin/validate-commit-msg"
}
},
"author": "vagusX",
"license": "MIT",
"bugs": {
"url": "https://github.com/vagusX/html-imports-loader/issues"
},
"homepage": "https://github.com/vagusX/html-imports-loader#readme",
"devDependencies": {
"ghooks": "^1.3.2",
"onchange": "^3.0.2",
"rimraf": "^2.5.4",
"rollup": "^0.36.0",
"rollup-plugin-buble": "^0.14.0",
"rollup-plugin-eslint": "^3.0.0",
"rollup-plugin-node-globals": "^1.0.8",
"semantic-release": "^4.3.5",
"standard": "^8.1.0",
"tape": "^4.6.0",
"validate-commit-message": "^3.0.1"
},
"dependencies": {
"loader-utils": "^0.2.16"
}
}
21 changes: 21 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# HTML Imports Loader for Webpack

![NPM](https://img.shields.io/npm/v/html-imports-loader.svg)
[![Build Status](https://travis-ci.org/vagusX/html-imports-loader.svg)](https://travis-ci.org/vagusX/html-imports-loader)

> [PostCSS](https://github.com/postcss/postcss) plugin to polyfill background rgba for IE8
## Detail about polyfill for background rgba in IE8

[Cross browser alpha transparent background CSS (rgba)](http://rland.me.uk/cross-browser-alpha-transparent-background-10-2011)

## Installation

```bash
$ npm install html-imports-loader
```

## Usage
wait for a minute

[![JavaScript Style Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
35 changes: 35 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const rollup = require('rollup')
const buble = require('rollup-plugin-buble')
const eslint = require('rollup-plugin-eslint')
const globals = require('rollup-plugin-node-globals')

const pkg = require('./package.json')
const external = Object.keys(pkg.dependencies)

let cache

rollup.rollup({
entry: 'lib/index.js',
cache: cache,
external: external,
plugins: [
eslint(),
buble(),
globals()
]
}).then(bundle => {
// cache bundle
cache = bundle
bundle.write({
format: 'cjs',
exports: 'named',
dest: pkg['main']
})

if (process.env.NODE_ENV === 'production') {
bundle.write({
dest: pkg['jsnext:main'],
format: 'es'
})
}
})

0 comments on commit aed4727

Please sign in to comment.