Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tool for generating CSS skeleton?

Tags:

css

markup

My HTML is all marked up, ready to make it rain CSS. The problem is that I have to go back and find out what all my id and class names are so I can get started. What I need is a tool that parses my HTML and spits out a stylesheet with all the possible elements ready to be styled (maybe even with some defaults). Does such a tool exist?

like image 604
dsims Avatar asked Aug 19 '08 20:08

dsims


People also ask

What is skeleton used for CSS?

Skeleton is a light-weight, responsive, and highly customizable CSS library built with mobile in mind. There's zero compiling or installing necessary, and it works well with additional CSS stylesheets and front-end Frameworks. Use skeleton for quick, up-and-running CSS that's great for demos or MVPs.

How do you make a skeleton screen loading effect CSS?

Create a new file index. html and write some HTML for the layout inside a parent <div> with class=”profile-container”. Add class=”skeleton” to every element in order to apply the skeleton screen loading effect. You'll be removing this class when the content is loaded using JavaScript.

What is a skeleton loader?

Skeleton loaders are visual placeholders for information while data is still loading. Anatomy. A skeleton loader provides a low fidelity representation of the interface that will be loaded.


3 Answers

I have a poor man's version of this I have used in the past... this requires jquery and firebug...

<script type="text/javascript">
    $(document).ready(function() {

        $('*[@id]').each(function() {
            console.log('#' + this.id + ' {}');
        });
        $('*[@class]').each(function() {
            $.each($(this).attr('class').split(" "), function() {
                console.log('.' + this + ' {}');
            });
        });
     });
</script>

it gives you something like this:

#spinner {}
#log {}
#area {}
.cards {}
.dialog {}
.controller {}

if you want them in "natural" page order instead...

<script type="text/javascript">
    $(document).ready(function() {
         $('*').each(function() {
             if($(this).is('[@id]')) {
                 console.log('#' + this.id + ' {}');
             }
             if($(this).is('[@class]')) {
                 $.each($(this).attr('class').split(" "), function() {
                     console.log('.' + this + ' {}');
                 });
             }
         });
     });
</script>

I just load the page with that script in there, then cut and paste the results out of firebug... then obviously, remove the script :)

you'll need to remove the dups manually or just toss in some simple dup checking logic with a map or array or something.. one for IDs and one for classes.

like image 126
danb Avatar answered Nov 11 '22 23:11

danb


When I first saw this, I thought "Great question! Neat answer, danb!"

After a little thought, I'm not so sure this is a good idea. It's a little like generating event handlers for all controls in an ASP.NET page, or generating CRUD procedures for all tables in a database. I think it's better to create them as needed for two reasons:

  1. Less clutter from empty style declarations
  2. Less temptation to misuse (or underuse) CSS by writing everything at the class level rather than using descendant selectors like (#navigation ul li a).
like image 42
Jon Galloway Avatar answered Nov 11 '22 23:11

Jon Galloway


http://lab.xms.pl/css-generator/ seems to fit the description.

like image 3
Andy Ford Avatar answered Nov 12 '22 00:11

Andy Ford