Well, the answer is a resounding yes! TinyMCE is completely NPM compatible.
While TinyMCE is already available in the NPM registry, if you have customized the TinyMCE SDK, getting your code onto NPM is a little more involved. In this post I’ll show you exactly how to do it.
NPM’s scope doesn’t just end at what’s already in its public registry. NPM can be used to import and track the changes of anything that’s in a Git repository. This can prove incredibly useful for in-house components whose codebase would otherwise have to be changed manually for every update.
Instead of re-distributing and re-building your application each time it’s changed, NPM allows a one-step update command that will pull the most recent version of your code from your Git repository. Neat!
The benefits of using NPM to maintain TinyMCE in your project are numerous. Not only do you receive all of the benefits of increased modularity and reliability, but using this style of NPM wizardry in your TinyMCE application is a great way to ensure full code unity between all members of your integration teams. If any programmatic changes need to be made to your specific integration of TinyMCE, the application that TinyMCE sits in will always have access to your most recent modifications and upgrades.
You’re probably wondering how TinyMCE + NPM is used in practice. Well, here’s how it’s done.
Reminder: These steps assume that your project already exists, and is set-up to use NPM for package management.
1. Upload TinyMCE code to a Git server.
The first step is finding your favorite Git-based source code hosting facility. Github and Bitbucket are usually the two most popular options for this.
Simply upload TinyMCE to your chosen Git service of choice (as long as it’s an actual server), and ensure you keep track of the URL of the repository it’s residing in.
For the sake of this example, let’s assume you’ve saved the TinyMCE codebase in a repository on GitHub at
(Keep in mind that your URL could look totally different. For example, if you’ve uploaded TinyMCE to a local BitBucket server, your URL might look like
2. NPM install from the Git repository.
Open a terminal session inside your project’s root directory and run the following commands:
npm install git+https://github.com/username/MyTinyMCE.git. (Remember, your Git path won’t be the same as this example).
This will pull down all the code you’ve uploaded to your Git repository, and store it in your node_modules folder. Cool, huh? Now, let’s verify that it’s actually in there. By typing the
ls node_modules command, you should be able to view the contents of the folder. If you see a directory with the same name as your Git repository (in this example, it would be MyTinyMCE), you won!
3. Update your codebase when changes are pushed.
Now you should be set to use TinyMCE directly from your set of node modules. But what do you do when a change has been pushed to the TinyMCE source code that’s sitting in your Git repository? It’s simple.
npm update in your project directory the same way we ran
npm install earlier. If someone has pushed a change to your TinyMCE repository, that command will pull down the most recent version of your TinyMCE code and automagically integrate it into your project through NPM.