--- layout: post category : Development tagline: "JSPM" tags : [JSPM, JavaScript, ECMA2015] --- {% include JB/setup %} This blog post demonstrates JSPM installation & configuration. If you've not used JSPM in your project already, then you've to do following steps to use our JavaScript repositories. **What is jspm?** JSPM provides you a module loader, based on ECMA 2015 standards & syntaxes. Using JSPM, you can develop your application based on ECMA 2015 modules specifications, no matter relying browser or server supports that feature or not. jspm combines followings: * Package management: It has its own package manager + it has a well-defined integration with other package managers such as npm. It can also retrieve whatever we need from GitHub repositories directly if any. * Module loader: It has its own ECMA 2015 based module loader. Plus, it is compatible with AMD, CommonJS module loaders. * Transpiler: It configures Babel or other transpilers into your project. This gives you an ability to use almost all new ECMA features on browsers without native support of those features. * Gives you an ability to define production Workflow. **How to install jspm?** To install jspm, you've to install nodejs first. Then, you should install jspm from command prompt using npm as following: npm install jspm -g Then run the following command in the root folder of your project to install jspm locally: npm install jspm -save-dev Then Run this command, again in root folder of your project to initialize jspm: jspm init after answering to jspm init questions with default values (just press enter), then it will do these for you: * It creates a package.json if not any. * It creates a config.js file. This is the configuration file for jspm itslef. * It configures babel for you as the transpiler. Finally run the last commnd to download required packages into your project: jspm install **Start Development** Create an index.js and an index.html file. Use following scripts in your index.html file: {% gist 854f91e8e71de2c56738 %} Then write following codes in your index.js: {% gist 10ae73088e3cbe83eb84 %} You can use almost all new ECMA features in your codes. To make this work, you should install a jspm package named linq4es2015 using the following command: jspm install linq4es2015 To get additional packages you can use following approaches: jspm install github:Fermium-co/LINQ4ES2015 This will install linq4es2015 from its Github releases. jspm install npm:jasmine This will install jasmine from npm packages. Note: jspm uses github to download most of packages, and GitHub introduces some limitation for anonymous requests. If you’ve GitHub account, configure your jspm with your account by running this command: jspm registry config github and follow steps. Feedbacks are welcomed.