README
grunt-sharepoint-editor-styles
Extract sharepoint editor styles into separate stylesheet.
The point of this plugin is to allow you to manage your styles the way you're used to – then generate the separate EditorStyles.css that Sharepoint uses for the ribbon controls.
Getting Started
This plugin requires Grunt.
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-sharepoint-editor-styles --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-sharepoint-editor-styles');
The "sharepoint_editor_styles" task
Overview
In your project's Gruntfile, add a section named sharepoint_editor_styles
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
sharepoint_editor_styles: {
options: {
// Options
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
})
Options
There are no options.
Usage Examples
In this example, we input a file that contains this:
.not-an-editor-style {
color: red;
}
p.nc-article-Element-an-editor-style {
-ms-name: "test";
color: blue;
}
The generated EditorStyles.css will look like this:
p.nc-article-Element-an-editor-style {
-ms-name: "test";
color: blue;
}
Only CSS rules with the -ms-name property are copied over.
grunt.initConfig({
sharepoint_editor_styles: {
options: {
CssFileToPrepend: 'path/to/css/file/to/prepend'
},
files: {
'path/to/where/sharepoint/stores/editorstyles/EditorStyles.css': ['src/app.css'],
},
},
})
Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
License
Copyright (c) 2014 Jakob Løkke Madsen. Licensed under the MIT license.