[ 12 posts ] Go to page 1, 2 Next

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 618
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

YUI Boilerplate

Post Posted: Sun Aug 21, 2011 2:40 pm
+0-
So, this thread with Mitch gave me the idea of making a YUI Boilerplate. Why? To address some of the most common questions in the forums: "where do I put my scripts?", "what's the best way of inserting YUI css?", "how do I create my own modules?", "how do I use HTML5 with YUI?". As @wrumsby pointed out it would be useful for starting new projects and for normalizing work in large teams.

What would it have to contain?

An index file
An index.html forked from the HTML5 Boilerplate. My index.html usually looks like this:

index.html

Click here to see the revision history on this Gist.
It would be awesome to get feedback from different YUI users to see what structure they usually chose.

A project structure
A folder structure where to put your files. Optionally it could include the YUI Builder as part of it.

A module template
With the folder structure set up, it could include a module template file and a configuration object already set up for it...

module template

Click here to see the revision history on this Gist.

HTML5?
Using HTML5 in IE6 is just a matter of doing document.createElement('nav') in the <head>. A Gallery module could do that and we could insert it concatenated with the YUI seed.

Any ideas?

Walter Rumsby

YUI Contributor

  • Username: wrumsby
  • Joined: Tue Feb 10, 2009 1:11 pm
  • Posts: 18
  • Location: Auckland, New Zealand
  • Twitter: wrumsby
  • GitHub: wrumsby
  • Gists: wrumsby
  • Offline
  • Profile
Tags:

Re: YUI Boilerplate

Post Posted: Sun Aug 21, 2011 3:46 pm
+0-
Quote:
Using HTML5 in IE6 is just a matter of doing document.createElement('nav') in the <head>. A Gallery module could do that and we could insert it concatenated with the YUI seed.


There's a Gallery module for Modernizr which should do that (the Gallery module should probably be updated to wrap Modernizr 2.x). HTML5 shims like this do have an issue with innerHTML (it looks like you've already seen that thread :))

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 618
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: YUI Boilerplate

Post Posted: Sun Aug 21, 2011 6:02 pm
+0-
I have. The thing is that I think Modernizer does too much. Do you need to check Modernizr.canvas when you'll use the Graphics module? Do you need to check Modernizr.hashchange when there is the History module? YUI does all the things Modernizer does and if it doesn't it probably will.

But the question is not whether to use Modernizr or not, the question is if we want to have the YUI seed file in the <head> or at the end of the <body>. I see 3 possibilities:
  1. Put this in the <head>
    Quote:
    <script src="http://yui.yahooapis.com/combo?3.4.0/build/yui/yui-min.js&3.4.0/build/oop/oop-min.js&3.4.0/build/event-custom-base/event-custom-base-min.js&3.4.0/build/event-custom-complex/event-custom-complex-min.js&3.4.0/build/intl/intl-min.js&gallery-2010.05.19-19-08/build/gallery-modernizr/gallery-modernizr-min.js"></script>
    <script>YUI().use('gallery-modernizr');</script>

    That means 32.52kb with gzip over the wire that need to download before anything is shown of the page
  2. Use Modernizer remotely by itself, not as a gallery module. Modernizer is about 1-2kb. So the cost is the HTTP request mostly.
  3. Just use a short inline script that adds support for HTML5 elements in IE, only if its necessary

    ...

    Click here to see the revision history on this Gist.

Anyway we should ask Matt if that issue was addressed in 3.4.0 or not, and there are some CSS styles that need to be added somewhere:

Future CSS Gallery module

Click here to see the revision history on this Gist.

And there is still the open question about whether to use HTML5 or not. The main idea is to have a zip file that lets you start fast with YUI.

Walter Rumsby

YUI Contributor

  • Username: wrumsby
  • Joined: Tue Feb 10, 2009 1:11 pm
  • Posts: 18
  • Location: Auckland, New Zealand
  • Twitter: wrumsby
  • GitHub: wrumsby
  • Gists: wrumsby
  • Offline
  • Profile

Re: YUI Boilerplate

Post Posted: Sun Aug 21, 2011 6:35 pm
+0-
I have been toying with the idea of updating the Modernizr module (or creating a Modernizr 2) module that is broken down into a number of modules, e.g. modernizr-base, modernizr-canvas, etc.

But yes, that is possibly a secondary question.

Evan Goer

YUI Contributor

  • Username: evangoer
  • Joined: Fri Dec 10, 2010 9:26 am
  • Posts: 20
  • Location: San Jose, CA
  • Twitter: evangoer
  • GitHub: evangoer
  • Gists: evangoer
  • IRC: evangoer
  • Offline
  • Profile

Re: YUI Boilerplate

Post Posted: Sun Aug 21, 2011 7:55 pm
+0-
Hi Juan,

1. I recommend being more aggressive about minimal markup. Get rid of the explicit <html>, <head>, and <body>. Both for practical reasons (it's smaller, cleaner, removes two un-necessary levels of indenting) and for branding reasons, to make YUI 3 Boilerplate look visually more clean and distinct from HTML5 Boilerplate.

2. In the use statement, consider actually using at least one module, just to serve as an example.

Walter Rumsby

YUI Contributor

  • Username: wrumsby
  • Joined: Tue Feb 10, 2009 1:11 pm
  • Posts: 18
  • Location: Auckland, New Zealand
  • Twitter: wrumsby
  • GitHub: wrumsby
  • Gists: wrumsby
  • Offline
  • Profile

Re: YUI Boilerplate

Post Posted: Sun Aug 21, 2011 8:05 pm
+0-
Quote:
In the use statement, consider actually using at least one module, just to serve as an example.


I almost always use 'node-base' and 'event-base' so perhaps the use statement could be something like:

Code:
YUI().use('event-base', function(Y) {
    Y.on('domready', function() {
        // ...
    }
});

Evan Goer

YUI Contributor

  • Username: evangoer
  • Joined: Fri Dec 10, 2010 9:26 am
  • Posts: 20
  • Location: San Jose, CA
  • Twitter: evangoer
  • GitHub: evangoer
  • Gists: evangoer
  • IRC: evangoer
  • Offline
  • Profile
Tags:

Re: YUI Boilerplate

Post Posted: Sun Aug 21, 2011 8:09 pm
+0-
Sure. In light of what wrumsby said, maybe something like this? https://gist.github.com/1161628

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 618
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: YUI Boilerplate

Post Posted: Mon Aug 22, 2011 7:42 am
+0-
That would be OK if it was just an example, but the idea is to have a file from which to start working without writing the boring parts all the time.

The idea is to put the YUI seed file at the bottom. So in that case using 'domready' is unnecessary.

I guess we need a customizable download for this. At least a simple version and a complex version. And integrating the YUI Grids Builder with the download process would be really cool. The simple version could just have a call to YUI().use('node'). The complex one should include a custom module with requirements and a YUI_config object.

I put a fork of the HTML5 Boilerplate here for experimentation https://github.com/juandopazo/yui3-boilerplate.

Evan Goer

YUI Contributor

  • Username: evangoer
  • Joined: Fri Dec 10, 2010 9:26 am
  • Posts: 20
  • Location: San Jose, CA
  • Twitter: evangoer
  • GitHub: evangoer
  • Gists: evangoer
  • IRC: evangoer
  • Offline
  • Profile

Re: YUI Boilerplate

Post Posted: Mon Aug 22, 2011 8:38 am
+0-
I like the idea of a basic version and an advanced version.

Should the simple version load SimpleYUI?

Also, is the goal, "A boilerplate page for using YUI" or "A alternative boilerplate page that happens to use YUI instead of jQuery, and also includes some other useful stuff we think you'd need"?

As an alternative to trying to re-launch the Grids Builder, maybe the boilerplate should just provide an example div structure for a 3-column layout -- and add some brief HTML comments that explain how to change the grid. The YUI 2 Grid Builder was cool, but YUI 3 Grids is *way* simpler -- to the point where I'm not convinced it even needs a grid builder.

Juan Ignacio Dopazo

YUI Contributor

  • Username: jdopazo
  • Joined: Fri Oct 02, 2009 5:39 am
  • Posts: 618
  • Location: Buenos Aires, Argentina
  • Twitter: juandopazo
  • GitHub: juandopazo
  • Gists: juandopazo
  • Offline
  • Profile

Re: YUI Boilerplate

Post Posted: Mon Aug 22, 2011 9:41 am
+0-
Right, I think both would be useful to different kinds of developers. There could be "A boilerplate page for using YUI" hosted in yuilibrary.com and maintained by you, and an HTML5 Boilerplate with YUI maintained by those of us interested in using HTML5.

I have my reservations about SimpleYUI, but if you think so the simple version should use SimpleYUI. The complex version should be aimed at using the Loader and optionally the YUI Builder.

You're right about the grids!
  [ 12 posts ] Go to page 1, 2 Next
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum