Giter VIP home page Giter VIP logo

cssprefix's Introduction

CSS Prefix

Just a precursor to this readme: this is just an idea. There are already other tools available, my plan is to add to those tools to help developers.

If this is a daft idea or doesn't have legs, say so. If there's better ways of doing something: say so.

Status

Fork the project, and run:

npm install
node prefix.js [url]

This should output the CSS with retrofitted vendor-prefixes where they were missing. This was about 3 hours work, so if it's shoddy - I do apologise!

The Plan

Plan to build a service for developer to submit a site to that will:

  1. Plug in the missing CSS vendor prefixes
  2. Give a simple yes or no as to whether it's got all the appropriate fallback CSS properties
  3. Provide a simple API for external tools to use

Intended use

First as a red light/green light app with the ability to download updated CSS. For example:

http://cssprefix.com/check?http://remysharp.com

This would return a simple page - with an indicator of whether they're not using an fallback CSS properties.

Also available for plugins to use - with the intention that a developer can use a simple plugin (for firebug, chrome extension, etc):

http://cssprefix.com/check.json?http://remysharp.com

Returns:

{ pass: true }

Or if fails:

{ pass: false, detail: [ /* here be properties that fail */ ]}

Extension could then show a bleemin' great RED FAIL icon, or happy face green unicorn riding a tick mark (or something).

Tasks

  • Process the parsing of markup without blocking further requests (probably using cluster in Node)
  • Parse HTML, CSS, @imports, etc to find all CSS embedded in document (note: I've done this before)
  • Parse CSS to process properties used (either's Zakas' CSS lint parser or Lea Verou's -prefix-free might have this already (no go on Lea's code - spoke to her, and it doesn't include a parser))
  • Have a converter library to go from CSS property to all fallbacks required. Question maybe this could also use a minimum browser support flag - such as supporting IE8 would require filters for opacity...maybe not worth it?
  • Site design - something clear, simple and to the point.
  • Not sure about this - but what about a wall of shame???!

Tool integration

Ideas how to get this baked in to developer's work flow:

  1. TextMate commands
  2. Other editor commands (I'm not a TextMate user - I know, weird, right!?)
  3. Browser extensions (as mentioned above)
  4. Others?

Technology:

Server side is in Node, using Express to get up and running quickly. It also means that I can pull in the CSS parsers without having to do (too much) conversion.

Collaboration

I'm looking for help in the following areas:

  • UX for web site
  • Design for web site
  • CSS, HTML & JavaScript for web site
  • Testing (once the server is complete)
  • Third party tools (extensions, proof of ideas)
  • Support on server-side JS (though I'll get as far as possibly in as short amount of time as possible first though)

cssprefix's People

Contributors

lennym avatar remy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cssprefix's Issues

Required: Logo/favicon

Designers wanted - post them here, sexiest wins (I am rather partial to a green unicorn riding a tickmark btw!)

Require: converter for gradients

Given a string passed to a JavaScript function:

background-image: -moz-linear-gradient(bottom, #F8F8F8, #FDFDFD) !important;

...can a function return an object with all supported gradient CSS values.

Note that if a linear gradient is passed, linear gradients should return, as with radial and non-specific.

Code must also come with tests.

Support for local websites

Problem

The proposed URL for checking websites, (http://cssprefix.com/[URI]) doesn't work with local web pages, either with a local webserver or plain file://.

This means that the developer needs to:

  1. Publish the website with incomplete CSS prefixes.
  2. Run the website through CSS Prefix.
  3. Download the updated code.
  4. Update their CSS.
  5. Re-publish the website.

This is a sub-optimal workflow. If CSS Prefix supports local web pages, the first deploy of the website could already have all the needed CSS prefixes.

Possible solution

I believe there are three ways to do this:

  1. Pasting the code to CSS Prefix
  2. Uploading the code to CSS Prefix (drag & drop would be nice)
  3. Developing browser extensions.

Browser extensions are able to do cross-domain requests, but I'm not sure if they can make requests from file:// websites.

Desired: Chrome extension to warn of prefix abuse

Use the service to determine the status of the currently viewed page and display the appropriate [traffic light] icon in the address bar.

Don't kill me! I know I'm asking for a vendor-specific implemented feature that determines whether there are vendor specific features in the page's style sheet, but I still see value in this.

Required: browser extensions

Using the green/red idea for the pass or fail, make a request to

"http://cssprefix.com/check.json?url=" + window.location

And the JSON returned contains:

{ pass: true }

(or false) - which will drive the icon.

Can this be done for all browsers?

Required: rabbitMQ support

I think a job should be shot off to something like rabbitMQ (which I have no experience in doing) and picked up by the prefix.js process. Once done, kickback to the main server and it would give links to the completed job.

Currently the forked child is nuking the server!

ØMQ (zeromq) isn't quite working

TL;DR - please have a look at my zeromq setup - it's wrong and needs fixing - help me Obi-Wan....


I'm using zeromq to post off the job of parsing all the CSS in a url, and then once it's complete, it passes the message back to the the main app.js node process.

Ideally, lots of requests could come in, and I could be running 2-4 worker processes (node prefix.js) and requests would queue up, get processed, and returned to the correct waiting http client.

My problem (aside from having never used zeromq or any queuing system for that matter) is that the job is passed off to the worker, but because (I think) I have an odd one-to-one queue set up, the same job gets returned to all of the clients.

It's tricky to replicate, because you need concurrent request - but here's an example:

curl "http://cssprefix.com/check.json?http://remysharp.com"; \
curl "http://cssprefix.com/check.json?http://jsconsole.com"; \
curl "http://cssprefix.com/check.json?http://remote-tilt.com"

{"pass":true}
{"pass":false,"lint":{"type":"warning","line":834,"col":3,"message":"The property -ms-transition is compatible with -webkit-transition, -moz-transition, -o-transition and should be included as well.","evidence":"  -webkit-transition: opacity 200ms;\r","rule":{"id":"compatible-vendor-prefixes","name":"Require compatible vendor prefixes","desc":"Include all compatible vendor prefixes to reach a wider range of users.","browsers":"All"}}}
{"pass":false,"lint":{"type":"warning","line":834,"col":3,"message":"The property -ms-transition is compatible with -webkit-transition, -moz-transition, -o-transition and should be included as well.","evidence":"  -webkit-transition: opacity 200ms;\r","rule":{"id":"compatible-vendor-prefixes","name":"Require compatible vendor prefixes","desc":"Include all compatible vendor prefixes to reach a wider range of users.","browsers":"All"}}}

Note that the last two return checks are exactly the same, even though the CSS is different for all three sites - which says to me that the worker returned to two clients - hence the screw up.

I'd love for someone with experience to dive in an have a decent crack at getting the parent / worker set up correct - then we'll have a web service that doesn't blow up my machine when concurrent requests come in!

Required: re-write to use cluster instead of fork

I'd rather be using (and did try) to use cluster to fork the process against each CPU and have the web service fire off jobs to the workers.

Currently I'm doing a fork on every request, and the net result is cpu spike and process top out.

I'd happily take a refactor of the app.js code.

Required: Homepage outline / wireframe

Similar to an HTML validator tool, though initially only supports url entry:

  • header
  • strap line information (I'll comment on what this will be later - probably: compatible vendor-prefixes in one click - or some such marketing crap)
  • form - enter the url to check and get back whether it's good or bad, and the updated CSS files to download
  • submitted form view should include the form (from line above), and above the form the status of the check: clear RED / GREEN for bad or ok. If bad, a download link to save the updated CSS
  • project information, how you can help, API access, extensions
  • footer / credits

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.