| Page 1 of 2 | [ 11 posts ] | Go to page 1, 2 Next |
|
Hi All,
I am trying to use yui loader to perform following task 1) pull the yui3 core and yui3 gallery from yahoo cdn network 2) pull the custom yui3 module created by me from my server (I don't have combo loader and I am okay to load file one at a time) My server side folder structure js/gf/build gf-simple - assets - gf-simple.css -gf-simple-debug.js -gf-simple-min.js I am using following configuration in HEAD section <script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script> <script type="text/javascript"> YUI_conf = { filter: "debug", charset: 'utf-8', groups:{ greenfield:{ combine:false, base:"./js/gf/build/", patterns:{ "gf-":{} } } } }; When I am doing YUI(YUI_conf).use('node',"gf-simple","scrollview", function (Y) { }); 1) It loads scroll view related files from yahoo cdn 2) It does load gf-simple-debug,js from my local server but it is not loading css from assets/ folder Does any one know what configuration should I use so that css can also be loaded from assets/ folder Mayank |
|
It might be easiest if you specifically define each module in the yui config.
Code: YUI_conf = { filter: "debug", charset: 'utf-8', groups:{ greenfield:{ base:"./js/gf/build/", combine:false, modules: { 'gf-simple': { path: 'gf-simple/gf-simple-min.js', requires: [ 'gf-simple-css' ], type: 'js' }, 'gf-simple-css': { path: 'gf-simple/assets/gf-simple-min.css', type: 'css' } } } } }; |
|
Thank you Steven!
|
|
Thank you Steven, one moew question. How could I make configuration such that when filter is on debug mode it downloads debug version else minified version
|
|
I don't know if this is well documented anywhere but I discovered this through trial and error. When you define the module using path or fullpath, set it to the -min version of the file. Then the filter 'DEBUG' will automatically change it to -debug and the filter 'RAW' will drop the suffix completely. There are also ways to create custom filters but I have never tried.
|
|
Sort of what Steven said.
Loader expects to be pointed at the minified version of the file by the 'path' attribute. But rather than using the 'filter' configuration option, which is applied to everything you load, I'd suggest using the 'filters' option, which is on this slide from my loader talk at YUIConf 2011. This allows you to pull in the debug version of only the modules you want to, which is actually a lot more helpful. |
|
Yeah there is no documentation about loader configuration
|
|
Thank Jeff for the slide.
|
|
Hi All,
Just wanted to updated I have added combo loader as well. I am using nodejs combo loader. This is simple nodejs script. Code: var comboServer = require('combohandler/lib/server'), app; app = comboServer({ roots: { '/gf': '../../Sites/yahoo/js/gf/build/' } }); app.listen(3000); Following configuration Code: YUI_conf = { charset: 'utf-8', groups:{ greenfield:{ base:"./js/gf/build/", root:'/', combine:true, comboBase:'http://localhost:3000/gf?', modules: { 'gf-simple': { requires: [ 'gf-simple-css' ], path:"gf-simple/gf-simple-min.js", type: 'js' }, 'gf-simple2': { requires: [ 'gf-simple2-css' ], path:"gf-simple2/gf-simple2-min.js", type: 'js' } } }, greenfieldCss:{ base:"./js/gf/build/assets/", comboBase:'http://localhost:3000/gf?', root:'assets/', combine:true, modules: { 'gf-simple-css': { path:"gf-simple-css/gf-simple.css", type: 'css' }, 'gf-simple2-css': { path:"gf-simple2-css/gf-simple2.css", type: 'css' } } } } }; It is working great, Thank you for all your help Mayank |
|
Hi All,
Just wanted to updated I have added combo loader as well. I am using nodejs combo loader. This is simple nodejs script. Code: var comboServer = require('combohandler/lib/server'), app; app = comboServer({ roots: { '/gf': '../../Sites/yahoo/js/gf/build/' } }); app.listen(3000); Following configuration Code: YUI_conf = { charset: 'utf-8', groups:{ greenfield:{ base:"./js/gf/build/", root:'/', combine:true, comboBase:'http://localhost:3000/gf?', modules: { 'gf-simple': { requires: [ 'gf-simple-css' ], path:"gf-simple/gf-simple-min.js", type: 'js' }, 'gf-simple2': { requires: [ 'gf-simple2-css' ], path:"gf-simple2/gf-simple2-min.js", type: 'js' } } }, greenfieldCss:{ base:"./js/gf/build/assets/", comboBase:'http://localhost:3000/gf?', root:'assets/', combine:true, modules: { 'gf-simple-css': { path:"gf-simple-css/gf-simple.css", type: 'css' }, 'gf-simple2-css': { path:"gf-simple2-css/gf-simple2.css", type: 'css' } } } } }; It is working great, Thank you for all your help Mayank |
| Page 1 of 2 | [ 11 posts ] | Go to page 1, 2 Next |
| 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 |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group