CSS Formatter Plugin for monaco-editor
CSS
/ LESS
/ SCSS
Support
CSS Formatter was builtin since monaco-editor@0.34.0
Compatible with Monaco Editor v0.12.0
and above
$ npm install css-format-monaco
ES Module
import cssFormatMonaco from "css-format-monaco";
const dispose = cssFormatMonaco(
// monaco-editor it self. If not provided, will use window.monaco instead.
// This could make the plugin support both ESM and AMD loaded monaco-editor
monaco,
// options
// see full option list at https://github.com/beautify-web/js-beautify#css--html
{
tab_size: 2
}
);
// run it if you want to dispose this plugin
dispose();
Browser
<script src="https://unpkg.com/css-format-monaco/dist/css-format-monaco.min.js"></script>
<script>
// NOTE: monaco-editor should be loaded first
// see above esm example for details
cssFormatMonaco(monaco);
</script>
MIT