raw-loader
Advanced tools
Comparing version 0.5.1 to 1.0.0-beta.0
@@ -8,4 +8,6 @@ /* | ||
this.value = content; | ||
return "module.exports = " + JSON.stringify(content); | ||
content = JSON.stringify(content) | ||
.replace(/\u2028/g, '\\u2028') | ||
.replace(/\u2029/g, '\\u2029'); | ||
return "export default " + content; | ||
} | ||
module.exports.seperable = true; |
{ | ||
"name": "raw-loader", | ||
"version": "0.5.1", | ||
"author": "Tobias Koppers @sokra", | ||
"description": "raw loader module for webpack", | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:webpack/raw-loader.git" | ||
}, | ||
"licenses": [ | ||
{ | ||
"type": "MIT", | ||
"url": "http://www.opensource.org/licenses/mit-license.php" | ||
} | ||
] | ||
"name": "raw-loader", | ||
"version": "1.0.0-beta.0", | ||
"author": "Tobias Koppers @sokra", | ||
"description": "raw loader module for webpack", | ||
"main": "index.js", | ||
"license": "MIT", | ||
"scripts": { | ||
"release": "standard-version" | ||
}, | ||
"devDependencies": { | ||
"standard-version": "^4.2.0" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:webpack/raw-loader.git" | ||
} | ||
} |
112
README.md
@@ -1,15 +0,109 @@ | ||
# raw loader for webpack | ||
[![npm][npm]][npm-url] | ||
[![node][node]][node-url] | ||
[![deps][deps]][deps-url] | ||
[![chat][chat]][chat-url] | ||
## Usage | ||
<div align="center"> | ||
<img width="200" height="200" | ||
src="https://cdn3.iconfinder.com/data/icons/lexter-flat-colorfull-file-formats/56/raw-256.png"> | ||
<a href="https://github.com/webpack/webpack"> | ||
<img width="200" height="200" | ||
src="https://webpack.js.org/assets/icon-square-big.svg"> | ||
</a> | ||
<h1>Raw Loader</h1> | ||
<p>A loader for webpack that lets you import files as a string.</p> | ||
</div> | ||
``` javascript | ||
var fileContent = require("raw!./file.txt"); | ||
// => returns file.txt content as string | ||
<h2 align="center">Install</h2> | ||
```bash | ||
npm install --save-dev raw-loader | ||
``` | ||
Don't forget to polyfill `require` if you want to use it in node. | ||
See `webpack` documentation. | ||
<h2 align="center">Usage</h2> | ||
## License | ||
Use the loader either via your webpack config, CLI or inline. | ||
MIT (http://www.opensource.org/licenses/mit-license.php) | ||
### Via webpack config (recommended) | ||
**webpack.config.js** | ||
```js | ||
module.exports = { | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.txt$/, | ||
use: 'raw-loader' | ||
} | ||
] | ||
} | ||
} | ||
``` | ||
**In your application** | ||
```js | ||
import txt from './file.txt'; | ||
``` | ||
### CLI | ||
```bash | ||
webpack --module-bind 'txt=raw-loader' | ||
``` | ||
**In your application** | ||
```js | ||
import txt from 'file.txt'; | ||
``` | ||
### Inline | ||
**In your application** | ||
```js | ||
import txt from 'raw-loader!./file.txt'; | ||
``` | ||
<h2 align="center">Maintainers</h2> | ||
<table> | ||
<tbody> | ||
<tr> | ||
<td align="center"> | ||
<img width="150" height="150" | ||
src="https://avatars3.githubusercontent.com/u/166921?v=3&s=150"> | ||
</br> | ||
<a href="https://github.com/bebraw">Juho Vepsäläinen</a> | ||
</td> | ||
<td align="center"> | ||
<img width="150" height="150" | ||
src="https://avatars2.githubusercontent.com/u/8420490?v=3&s=150"> | ||
</br> | ||
<a href="https://github.com/d3viant0ne">Joshua Wiens</a> | ||
</td> | ||
<td align="center"> | ||
<img width="150" height="150" | ||
src="https://avatars3.githubusercontent.com/u/533616?v=3&s=150"> | ||
</br> | ||
<a href="https://github.com/SpaceK33z">Kees Kluskens</a> | ||
</td> | ||
<td align="center"> | ||
<img width="150" height="150" | ||
src="https://avatars3.githubusercontent.com/u/3408176?v=3&s=150"> | ||
</br> | ||
<a href="https://github.com/TheLarkInn">Sean Larkin</a> | ||
</td> | ||
</tr> | ||
<tbody> | ||
</table> | ||
[npm]: https://img.shields.io/npm/v/raw-loader.svg | ||
[npm-url]: https://npmjs.com/package/raw-loader | ||
[node]: https://img.shields.io/node/v/raw-loader.svg | ||
[node-url]: https://nodejs.org | ||
[deps]: https://david-dm.org/webpack/raw-loader.svg | ||
[deps-url]: https://david-dm.org/webpack/raw-loader | ||
[chat]: https://badges.gitter.im/webpack/webpack.svg | ||
[chat-url]: https://gitter.im/webpack/webpack |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
5195
6
12
110
1