diff --git a/src/i18n/en/docs/assets.md b/src/i18n/en/docs/assets.md index 47d3eacfa..fdd4703c9 100644 --- a/src/i18n/en/docs/assets.md +++ b/src/i18n/en/docs/assets.md @@ -14,7 +14,7 @@ const dep = require('./path/to/dep'); import dep from './path/to/dep'; ``` -You can also import non-JavaScript assets from a JavaScript file, e.g. CSS or even an image file. When you import one of these files, it is not inlined as in some other bundlers. Instead, it is placed in a separate bundle (e.g. a CSS file) along with all of its dependencies. When using [CSS Modules](https://github.com/css-modules/css-modules), the exported classes are placed in the JavaScript bundle. Other asset types export a URL to the output file in the JavaScript bundle so you can reference them in your code. +You can also import non-JavaScript assets from a JavaScript file, e.g. CSS, HTML or even an image file. When you import one of these files, it is not inlined as in some other bundlers. Instead, it is placed in a separate bundle (e.g. a CSS file) along with all of its dependencies. When using [CSS Modules](https://github.com/css-modules/css-modules), the exported classes are placed in the JavaScript bundle. Other asset types export a URL to the output file in the JavaScript bundle so you can reference them in your code. ```javascript // Import a CSS file @@ -25,6 +25,13 @@ import classNames from './test.css'; // Import the URL to an image file import imageURL from './test.png'; + +// Import an HTML file +import('./some.html') +// or: +import html from './some.html' +// or: +require('./some.html') ``` If you want to inline a file into the JavaScript bundle instead of reference it by URL, you can use the Node.js `fs.readFileSync` API to do that. The URL must be statically analyzable, meaning it cannot have any variables in it (other than `__dirname` and `__filename`).