user636525
user636525

Reputation: 3200

JSPM with locally modified JS and CSS files

I am using JSPM with aurelia and i have some shims(JQuery Plugins) that i load from github. But i would like to make some modifications to some css and js files from those plugins to cater to my app requirements.

What is the preferred way to accomplish this in JSPM ? Are we suppose to make local modifications to JS and CSS files ? Or create a new github repo for these changes and pull from this new repo ?

Upvotes: 2

Views: 97

Answers (1)

Dwayne Charrington
Dwayne Charrington

Reputation: 6632

It is not considered best practice to modify plugin files directly. Ideally depending on the plugin you want to extend the original and override its methods. But understandably, not a lot of plugins work on the premise of being extendable.

You have a couple of choices:

Recommended approach

Fork the original plugin and then install your fork of the plugin using Jspm like this: jspm install github:username/myrepo and you can even alias your install by typing: jspm install myalias=github:username/myrepo

Not-recommended approach

Download the plugin from Github (or wherever) and create a folder inside of your application (maybe vendor or third_party copy the files into the folder and then reference this plugin via import or System.import

The first approach is recommended. Fork the plugin and make changes using source control to ensure you can update to later versions when the source plugin is updated. The secondary approach of copying/pasting means your changes are harder to maintain.

Upvotes: 1

Related Questions