Scripts n Styles received a major update today. The two big features added are LESS.js support and Dynamic Shortcodes! The “Global” Settings page now has a LESS editor with syntax highlighting (via CodeMirror) and on-the-fly compiling so you can see how it’ll be outputted on the theme-side. The per-page meta-box has gained a new tab in which you can create one-off shortcodes which can contain arbitrary HTML content.
Scripts n Styles is a free OpenSource GPL project that you can fork and contribute to on github! (You can also fork and contribute to CodeMirror and LESS.js)
As a Shortcode example: I placed the following html into the Shortcodes tab and gave it the name “tweet test”.
<a href="https://twitter.com/share" data-via="WraithKenny" data-size="large" data-related="unFocusProjects" data-hashtags="ScriptsnStyles">Tweet</a>
I then use the shortcode [sns_shortcode name="tweet test"] to display:
Scripts n Styles is a tool to allow admins (and editors in single installs) to add scripts and styles without editing template files, or worrying about authors overwriting the code (code is stripped when an author updates since they don’t have permission to use unfiltered html).
Improvements in version 2.0.1:
The meta box has been improved to provide a tabbed interface for less clutter, and syntax highlight and formating is added using the open-source CodeMirror 2.1.
An option has been added to allow adding script to the head element in addition to the traditional bottom of the page spot.
An Options page (under Tools) has been added so you can add Script n Styles to the entire site, rather then just the individual posts and pages.
Some minor code improvements:
- Better selection of post_types.
- micro-optimization for storage of class names.
- Defined a later priority for Scripts n Styles to print after other scripts and styles.
- Better adherence to coding standards.
- began contextual help (notes on capabilities).