Blank web application built with Typescript and LESS
The build script uses Webpack to perform the transpilation and bundling steps:
npm run build
Typescript files will be transpiled and bundled in main.[hash].js, LESS files imported by .ts files will be bundled in main.[hash].css, and both of those files will be reference by index.html. (The build output can be found in ./dist)
To build for production, set the NODE_ENV environment variable to production:
NODE_ENV=production npm run build
To run the server:
npm start- Open
localhost:9000in your browser
Any changes to index.html, *.ts, or *.less files will be immediately reflected in the browser without required a page refresh.
The test script will run any file ending with .tests.ts:
npm test
Code coverage may be viewed in ./coverage/lcov-report/index.html.
The entry point of the Typescript files is ./src/index.ts; therefore, any file that will be included in the .js bundle must be ultimately imported from index.ts.
*.less files must be imported from Typescript in order to be included in the .css bundle. Note that even though the styles are "imported" into a code file, they are NOT inlined into the .js bundle. The MiniCssExtractPlugin ensures that any LESS styles imported into code are moved from the code into the style bundle. (The less.d.ts file prevents compile-time errors when importing non-Typescript content.)
Example:
import './index.less';
const code = 'goes here';Add your markup to ./src/index.html. This file is used as the "template" when running Webpack. The resulting file will include script and link tags to the .js and .css bundles.
Generated with generator-ts-website