rollup-plugin-string-import 1.0.1 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +18 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -94,6 +94,24 @@ Default: `undefined`
94
94
 
95
95
  A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which specifies the files in the build the plugin should _ignore_. By default no files are ignored.
96
96
 
97
+ ### `transform`
98
+
99
+ Type: `(content: String, file: String) => String`<br>
100
+ Default: `content => content`
101
+
102
+ A transformer function that will be applied to each matched file. In this example, we append "Hello World" to each `.txt` file:
103
+
104
+ ```typescript
105
+ ...
106
+ importAsString({
107
+ include: ['**/*.txt', '**/*.frag', '**/*.vert'],
108
+ exclude: ['**/*.test.*'],
109
+ transform:
110
+ (content, file) => file.endsWith('.txt') ? `${content}\nHello World` : content,
111
+ }),
112
+ ...
113
+ ```
114
+
97
115
  ## Meta
98
116
 
99
117
  Licensed under the GPL version 3.0 or higher
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rollup-plugin-string-import",
3
- "version": "1.0.1",
3
+ "version": "1.1.1",
4
4
  "description": "Import any file as a string",
5
5
  "main": "dist/index.js",
6
6
  "repository": "git@github.com:ExposedCat/rollup-plugin-string.git",