Installation
Package
Install with YARN:
yarn add @dogstudio/highway
Install with NPM:
npm install @dogstudio/highway
If the NPM version is less than 5.0.0 in your local machine, use
npm install --save @dogstudio/highway
Easy Usage
Highway's package contains a built
folder with the ready-to-use ES5 version of Highway. The ES6 version of Highway has been compiled into this ES5 version with an optimized configuration we defined so developers don't need to bother with the compilation process.
Once the package is installed, Highway can be imported in Javascript with the import
keyword to have access to Highway.Core
, Highway.Renderer
and Highway.Transition
which are the ready-to-use classes that can be extended.
import Highway from '@dogstudio/highway';
This will import the node_modules/@dogstudio/highway/build/highway.js
file which is the ready-to-use ES5 version of Highway. Make sure to resolve the node_modules
folder so that the script will look into it to import the package.
Advanced Usage
The ES5 version is available for developers who don't want to bother with the compilation process but the ES6 source files are available as well for advanced developers who prefer to manage the compilation process to ES5 on their own.
The ES6 version of Highway needs to be compiled to ES5 in order to work in browsers using tools like Webpack or Parcel. Don't forget that the node_modules
folder might be ignored by default including all packages inside it. With Webpack as an example specific packages can be included in the rules:
// webpack.config.js
modules.exports = {
[...]
module: {
rules: [
{
test: /\.js$/,
include: [
path.resolve(__dirname, 'node_modules', '@dogstudio', 'highway')
],
[...]
}
]
}
[...]
};
Once included all the files imported from the package will be compiled regarding the configuration. Highway's package contains a src
folder with the ES6 source files of Highway. It can be imported in Javascript with the import
keyword to have access to Highway.Core
, Highway.Renderer
and Highway.Transition
which are the ready-to-use classes that can be extended.
import Highway from '@dogstudio/highway/src/highway';
This will import the node_modules/@dogstudio/highway/src/highway.js
file which is the main ES6 source file of Highway. Make sure to resolve the node_modules
folder so that the script will look into it to import the package.