25
How to display Fiddle from Gist @imehr Mehran Mozaffari Created by: Saturday, 3 March 12

How to display_fiddle_from_gist

Embed Size (px)

DESCRIPTION

Jsfiddle is a great tool to try js/css/html codes online and sharing those codes with other developers. In this slide I go through the process of converting a Gist (gist.github.com) to a fiddle. I explain the api behing Jsfiddle to create a multi files gist and then create a fiddle on the fly to be able to try the code.http://mehrjs.com

Citation preview

Page 1: How to display_fiddle_from_gist

How to display Fiddle from Gist

@imehrMehran MozaffariCreated by:

Saturday, 3 March 12

Page 2: How to display_fiddle_from_gist

How to display Fiddle from Gist

Saturday, 3 March 12

Page 3: How to display_fiddle_from_gist

How to display Fiddle from Gist

Saturday, 3 March 12

Page 4: How to display_fiddle_from_gist

Creating a fiddle on the fly and fill it with some demo codes from a gist and be able to try the code with all library dependencies on Jsfiddle.net.

The goal

Saturday, 3 March 12

Page 5: How to display_fiddle_from_gist

A multi files gist, hosted on gist.github.com

STEP 1

Saturday, 3 March 12

Page 6: How to display_fiddle_from_gist

Just enter a URL with a very basic api

and then...

STEP 2

Saturday, 3 March 12

Page 7: How to display_fiddle_from_gist

You will get a fresh new fiddle filled up with all codes, coming directly from that gist and ready to try in Jsfiddle.

STEP 3

Saturday, 3 March 12

Page 8: How to display_fiddle_from_gist

Go to gist.github.com and create a new gist.

Saturday, 3 March 12

Page 9: How to display_fiddle_from_gist

Go to gist.github.com and create a new gist.

This description field can be anything to explain what this gist is all about.

Saturday, 3 March 12

Page 10: How to display_fiddle_from_gist

Go to gist.github.com and create a new gist.

The file names in this gist are important to follow a specific pattern.

Saturday, 3 March 12

Page 11: How to display_fiddle_from_gist

Go to gist.github.com and create a new gist.

Allowed file names• fiddle.js• fiddle.html• fiddle.css• fiddle.manifest• fiddle.response.html

Saturday, 3 March 12

Page 12: How to display_fiddle_from_gist

Got to gist.github.com and create a new gist.

Allowed file names• fiddle.js• fiddle.html• fiddle.css• fiddle.manifest• fiddle.response.html

CSSHTML

JAVASCRIPT

AJAX RESPONSE / PAGE RENDER

INFO AND RESOURCES

Saturday, 3 March 12

Page 13: How to display_fiddle_from_gist

Got to gist.github.com and create a new gist.

Allowed file names

Write your CSS code here. This code will be used in CSS pane inside the fiddle later on.

Saturday, 3 March 12

Page 14: How to display_fiddle_from_gist

Got to gist.github.com and create a new gist.

Click here and add another file to your gist and name it fiddle.html.

Saturday, 3 March 12

Page 15: How to display_fiddle_from_gist

Got to gist.github.com and create a new gist.

This code will show up under HTML pane inside the fiddle.

Saturday, 3 March 12

Page 16: How to display_fiddle_from_gist

Got to gist.github.com and create a new gist.Add another file to this gist and name it fiddle.js and write all you JS codes here. This code will show up under Javascript pane in fiddle.

Saturday, 3 March 12

Page 17: How to display_fiddle_from_gist

Got to gist.github.com and create a new gist.

This would be your JS code in fiddle.

Saturday, 3 March 12

Page 18: How to display_fiddle_from_gist

Got to gist.github.com and create a new gist.

fiddle.manifestis a description of the gist written in YAML, the structure is compatible with the MooTools doc.

Saturday, 3 March 12

Page 19: How to display_fiddle_from_gist

Got to gist.github.com and create a new gist.

fiddle.manifestis a description of the gist written in YAML.The content of this manifest will show up under info tab in the fiddle.

Saturday, 3 March 12

Page 20: How to display_fiddle_from_gist

Got to gist.github.com and create a new gist.fiddle.manifest (in YAML format)

name: the title of this code or appdescription: description about this codeauthors:

- author 1 - author 2- ...

resources:- http://....link to a js file- http:// ... link to a css file- ...

normalize_css: yes / no

Saturday, 3 March 12

Page 21: How to display_fiddle_from_gist

After creating a new gist with multiple files, you can easily run it inside a fiddle by using the following api. Just enter the URL with the following pattern in your browser and all those files inside the gist will come together in one fiddle.

http://jsfiddle.net/gh/gist/{framework}/{version}/{gist_id}/

Making the fiddle URL

http://jsfiddle.net/gh/gist/mootools/1.2/606699/

Saturday, 3 March 12

Page 22: How to display_fiddle_from_gist

You can add an extra option to indicate all dependencies related to this gist codes. In order to indicate those dependencies use a comma separated list of those dependencies as the following format:

http://jsfiddle.net/gh/gist/{framework}/{version}/dependencies/{dependencies_list}/{gist_id}/

The fiddle URL with extra option

http://jsfiddle.net/gh/gist/jquery/1.4.4/dependencies/lint,ui/606699/

Saturday, 3 March 12

Page 23: How to display_fiddle_from_gist

How to display Fiddle from Gist

Saturday, 3 March 12

Page 24: How to display_fiddle_from_gist

How to display Fiddle from Gist

Saturday, 3 March 12