Boilerplate that shows how to setup Carbon LDP SDK in a JavaScript ES2015 application.
This boilerplate uses Webpack as a module loader which also bundles the code and serves the app. Other setups could use other module loaders like requirejs,
browserify or no module loader at all (although that would mean no support for import statements).
-
Install node.js (we recommend installing the "Current" version)
-
cd into the project's folder:
cd ~/your/path/carbonldp-js-es2015-boilerplate/
-
Install the project's dependencies by running the following command:
npm install
-
Run the application with the following command:
npm start
This will run a webpack-dev-server instance that will serve the project's files.
And that's it, you're ready to use the Carbon SDK.
package.json defines the following tasks:
build: Generates the final distribution versionclean:dist: Cleansdistdirectorystart: Runsserver:devserver:dev: Runs Webpack bundler in dev mode and starts the app
To generate the production version, just run this command:
npm run buildIt will generate the dist folder with the production-ready files.
.
├── config # Source code of the application
│ ├── webpack.common.js # Settings shared to create the dev/prod bundles
│ ├── webpack.config.js # Settings to create the dev bundle
│ ├── webpack.helpers.js # Helpers used in webpack config files
│ └── webpack.prod.js # Settings to create the prod bundle
├── dist # Distribution ready files
├── node_modules # npm dependencies (don't touch them)
├── src # Source code of the application
│ ├── app.js # Application main script file importing Carbon
│ ├── index.html # Entry point for the app
│ └── polyfills.js # File importing the required polyfills to work on old browsers
├── .gitignore # Configuration file telling git what files to ignore
├── CHANGELOG # File to track package changes
├── favicon.ico # Small icon to display on browsers when visitng the app
├── package.json # npm configuration file listing the project's packages
├── package-lock.json # Describes the exact tree generated by installing packages
└── README.md # this
- Implement a testing suite