0.2.1 • Published 10 years ago

grunt-css-idtoattr v0.2.1

Weekly downloads
3
License
-
Repository
github
Last release
10 years ago

grunt-css-idtoattr

A Grunt Plugin to convert all ID-Selectors to in Attribute-Selectors.

Ever since the CSS became more complex, people argued wether to use ID-Selectors in CSS. Some people defend the use of ID-Selectors while others don't. One possible solution to deal with ID-Selectors is to use attribute-selectors instead. While it is a hack these selectors have the same specificity as a class. Maybe this grunt task helps to use IDs in CSS but not at the cost of specificity.

This plugins uses Rework and the rework-idtoattr plugin.

Getting Started

This plugin requires Grunt ~0.4.5

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-css-idtoattr --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-css-idtoattr');

The "cssidtoattr" task

Overview

In your project's Gruntfile, add a section named cssidtoattr to the data object passed into grunt.initConfig().

grunt.initConfig({
  cssidtoattr: {
    files: {
      'dest/output.css': ['src/css/source_one.css', 'src/css/source_two.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.

Release History

21-7-2014: Create repo

0.2.1

10 years ago

0.2.0

10 years ago

0.1.0

10 years ago