Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Sigil > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 03-23-2016, 05:06 PM   #1
Doitsu
Grand Sorcerer
Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.Doitsu ought to be getting tired of karma fortunes by now.
 
Doitsu's Avatar
 
Posts: 5,584
Karma: 22735033
Join Date: Dec 2010
Device: Kindle PW2
[Plugin] CSSLint - Simple CSSLint wrapper

Current Version: "0.2"

This plugin is a very simple CSSLint wrapper, which allows you to check all stylesheets in the currently loaded book with Sigil.

Unfortunately, it does not work with OSX!

Note that since CSSLint is executed in the background, you'll have to wait a couple of seconds before the messages are being displayed.

Disclaimer:
This is a beta version. Even though it's unlikely that it'll somehow corrupt the epub that you're working on or crash Sigil, you might want to save your ePub in Sigil before running this plugin.
Since CSSLint wasn't optimized for ebooks, you also might want to check your stylesheets via Validate with W3C.

System requirements

If you're using an older Sigil version, you'll need to install a Python interpreter and select its path in the Manage Plugins dialog box. This plugin obviously also requires CSSLint.

Installation

CSSLint:

1. Install npm (Linux users might also need to install node.js.)
2. Enter the following command as an administrator in a terminal or Admin command prompt window:
Code:
npm install -g csslint
If all goes well you should get a version number, if you enter csslint --version. (If you don't get a version number the plugin won't work.)

Sigil:

1. Select Manage Plugins from the Plugins menu. Then select Use Bundled Python. (If you haven't updated to the latest Sigil version click one of the Auto buttons to detect the path or click Set to manually select the Python interpreter path.)
2. Click Add Plugin and select CSSLint_v0.2.zip. This will install the CSSLint plugin, which you can select via Plugins > Validation > CSSLint.

Known issues:

1. Calibre page_styles.css

For some reason CSSLint can't handle the following default page_styles.css rule added by Calibre:

Code:
@page {
    margin-bottom: 5pt;
    margin-top: 5pt
    }
and won't check the remainder of the CSS file. If you use this rule in a stylesheet temporarily delete it or move it to a separate page_styles.css file.

Alternatively, change the value of the following CSSLint.json entry to false:

Code:
	"shorthand": false,
2. CSSLint displays too many messages.

CSSLint is rather picky and'll flag a couple of issues that are totally irrelevant for epubs. However, you can customize CSSLint via a CSSLint.json file that has the same format as the default .csslintrc file.

a) Create a CSSLint folder in sigil-ebook/sigil/plugins_prefs (Edit > Preferences > Open Preferences Location)
b) Create a CSSLint.json text file with the following contents and copy it to sigil-ebook/sigil/plugins_prefs/CSSLint/

Spoiler:
Code:
{
	"adjoining-classes": true,
	"box-model": true,
	"box-sizing": true,
	"bulletproof-font-face": true,
	"compatible-vendor-prefixes": true,
	"display-property-grouping": true,
	"duplicate-background-images": true,
	"duplicate-properties": true,
	"empty-rules": true,
	"fallback-colors": true,
	"floats": true,
	"font-faces": true,
	"font-sizes": true,
	"gradients": true,
	"ids": true,
	"import": true,
	"important": true,
	"known-properties": true,
	"non-link-hover": true,
	"outline-none": true,
	"overqualified-elements": true,
	"qualified-headings": true,
	"regex-selectors": true,
	"shorthand": true,
	"star-property-hack": true,
	"text-indent": true,
	"underscore-property-hack": true,
	"vendor-prefix": true,
	"unique-headings": true,
	"universal-selector": true,
	"unqualified-attributes": true,
	"zero-units": true
}


c) Disable unwanted rules by changing their values from true to false. (You can also delete unwanted entries, however, make sure that the last entry isn't terminated by a comma.)

For example, my CSSLint.json file looks like this:

Spoiler:
Code:
{
	"bulletproof-font-face": false,
	"overqualified-elements": false,
	"shorthand": false
}


For more information on these rules and why the developers implemented them see the CSSLint Wiki.

License: GNU General Public License v3 (GPL-3)
Attached Files
File Type: zip CSSLint_v0.2.zip (2.4 KB, 1192 views)

Last edited by Doitsu; 08-15-2017 at 01:28 PM. Reason: Updated version for Sigil 0.9.7 attached
Doitsu is offline   Reply With Quote
Old 03-23-2016, 06:51 PM   #2
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,553
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Added to the plugin index. Thanks!
DiapDealer is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre annotations and highlight extract plugin for the Nook Simple Touch? einkuser Plugins 15 01-24-2015 08:13 PM
Install of simple plugin works on Linux and Win but not on OSX kabirmaar Development 9 07-26-2014 07:49 PM
Make a simple Plugin for Full Text Search using Recoll Satas Development 9 07-20-2013 04:15 PM
Adding an SVG Wrapper ghostyjack Sigil 16 06-15-2013 05:13 AM
An Issue about a SVG wrapper RbnJrg Kindle Formats 29 06-10-2013 08:11 PM


All times are GMT -4. The time now is 07:59 PM.


MobileRead.com is a privately owned, operated and funded community.