Socket
Book a DemoInstallSign in
Socket

ember-cli-codemirror-shim

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ember-cli-codemirror-shim

The default blueprint for ember-cli addons.

latest
npmnpm
Version
1.1.2
Version published
Maintainers
1
Created
Source

Ember-cli-codemirror-shim

ES6 accessible module for importing codemirror from npm.

Usage:

Install

# From the command line:
ember install ember-cli-codemirror-shim

Configure

Create a codemirror configuration object in your ember-cli-build.js file to specify what codemirror assets you would like to include in your project:

var EmberAddon = require('ember-cli/lib/broccoli/ember-addon');

module.exports = function(defaults) {
  var app = new EmberAddon(defaults, {

    codemirror: {
      addons: ['mode/simple.js', 'mode/multiplex.js', 'comment/comment.js'],
      modes: ['xml', 'javascript', 'handlebars', 'htmlmixed', 'css'],
      themes: ['panda-syntax'],
      keymaps: ['sublime']
    }
  });

  return app.toTree();
};

IMPORTANT: The CodeMirror source repository keymaps, modes and theme files follow a consistent structure, so you only need to pass the name for each of these configs. The CodeMirror addons are organized differently and do not have a uniform file structure. Because of this you have to pass in the file path to the addon you would like to import relative to the CodeMirror addons directory: CodeMirror Github Addons Dir.

Eg, to import the markdown fold addon, you would pass:

codemirror: {
  addons: ['fold/markdown-fold.js']
}

The CodeMirror Manual has details on modes, themes, keymaps, etc.

Import

// Some Awesome Component
import Ember from 'ember';
import CodeMirror from 'codemirror';

// Do amazing things!

Thank You:

BIG THANK YOU TO:

  • ivy-codemirror for a codemirror reference.
  • ember-cli-moment-shim for a reference to creating a shim for an npm package.

This shim wouldn't be possible without the work they have done.

TODO

  • Configurable themes, keymaps && modes
  • [] Fastboot compatability
  • Allow for importing from addons dir

Keywords

ember-addon

FAQs

Package last updated on 24 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts