A browser based code editor
Find a file
2018-05-31 14:27:14 -06:00
loaders Add webpack loader plugin 2018-04-09 16:36:25 +02:00
plugins Improve README, webpack consumption 2018-04-09 16:53:49 +02:00
test Add simple way to test (#12) 2018-05-18 14:48:27 +02:00
.gitignore Add simple way to test (#12) 2018-05-18 14:48:27 +02:00
.npmignore Add simple way to test (#12) 2018-05-18 14:48:27 +02:00
features.js Fixes #12: Catch up with 0.13.x rename 2018-05-18 14:48:47 +02:00
index.js rename parameter string to str purely to prevent confusion 2018-05-31 14:27:14 -06:00
languages.js Fixes #12: Catch up with 0.13.x rename 2018-05-18 14:48:47 +02:00
LICENSE Initial commit 2018-03-26 04:32:10 -07:00
package-lock.json 1.2.1 2018-05-30 11:25:44 +02:00
package.json 1.2.1 2018-05-30 11:25:44 +02:00
README.md Improve README, webpack consumption 2018-04-09 16:53:49 +02:00

Monaco Editor Webpack Loader Plugin

A plugin to simplify loading the Monaco Editor with webpack contributed by Tim Kendrik.

Installing

npm install monaco-editor-webpack-plugin

Using

  • webpack.config.js:
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin');

module.exports = {
  entry: './index.js',
  output: {
    path: path.resolve(__dirname, 'dist'),
    filename: 'app.js'
  },
  plugins: [
    new MonacoWebpackPlugin()
  ]
};
  • index.js:
import * as monaco from 'monaco-editor';

monaco.editor.create(document.getElementById('container'), {
  value: 'console.log("Hello, world")',
  language: 'javascript'
});

Options

Options can be passed in to MonacoWebpackPlugin. They can be used to generate a smaller editor bundle by selecting only certain languages or only certain editor features:

  • output (string) - append a certain string to all generated files.
    • default value: ''.
  • languages (string[]) - include only a subset of the languages supported.
    • default value: ['bat', 'coffee', 'cpp', 'csharp', 'csp', 'css', 'dockerfile', 'fsharp', 'go', 'handlebars', 'html', 'ini', 'java', 'json', 'less', 'lua', 'markdown', 'msdax', 'mysql', 'objective', 'pgsql', 'php', 'postiats', 'powershell', 'pug', 'python', 'r', 'razor', 'redis', 'redshift', 'ruby', 'sb', 'scss', 'solidity', 'sql', 'swift', 'typescript', 'vb', 'xml', 'yaml'].
  • features (string[]) - include only a subset of the editor features.
    • default value: ['accessibilityHelp', 'bracketMatching', 'caretOperations', 'clipboard', 'codelens', 'colorDetector', 'comment', 'contextmenu', 'coreCommands', 'cursorUndo', 'dnd', 'find', 'folding', 'format', 'gotoDeclarationCommands', 'gotoDeclarationMouse', 'gotoError', 'gotoLine', 'hover', 'inPlaceReplace', 'inspectTokens', 'iPadShowKeyboard', 'linesOperations', 'links', 'multicursor', 'parameterHints', 'quickCommand', 'quickFixCommands', 'quickOutline', 'referenceSearch', 'rename', 'smartSelect', 'snippets', 'suggest', 'toggleHighContrast', 'toggleTabFocusMode', 'transpose', 'wordHighlighter', 'wordOperations'].

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.