{ "info": { "author": "Rocky Burt", "author_email": "rocky@serverzen.com", "bugtrack_url": null, "classifiers": [], "description": "Introduction\n============\n\n*khufu_javascript* provides various ways for including Javascript into\nyour Khufu/Pyramid app.\n\nDojo Support\n============\n\n``khufu_javascript.dojo`` provides support for working with Dojo.\n\nUsage\n-----\n\nSetting up khufu_javascript.dojo is easy.\n::\n\n # config must be an instance of pyramid.config.Configurator\n config.include('khufu_javascript.dojo')\n config.register_script_dir('myproject:javascripts')\n\nThe previous example will iterate over all *.js files in the ``javascripts``\ndirectory relative to the ``myproject`` package (``register_script_dir`` takes\nan asset spec). For each .js file found it scans for a \"dojo.provides('foo')\"\nentry and registers that module with khufu_javascript.\n\nAfter having registered scripts, they can be accessed via the ``dojo`` view\nat the root of the site. If one of the javascripts found has\n\"dojo.provides('foo.bar')\" then the dojo view will provide::\n\n http://127.0.0.1:8080/dojo/foo/bar.js\n\nAnyone working with Dojo modules knows that there still needs to a way\nto tell Dojo to look at */dojo/whatever* when looking up non-core modules.\nDojo handles this with *djConfig* which can be used to setup module load\npaths.\n\nAfter having registered scripts, inside of your views you can simply call\n``khufu_javascript.dojo.render_header``.\n::\n\n # views.py\n from khufu_javascript.dojo import render_header\n\n @view_config('myview', renderer='templates/foo.jinja2',\n context=Root)\n def myview(request):\n dojo_header = render_header(request)\n return {'dojo_header': dojo_header}\n\n \n \n
\n {{ dojo_header|safe }}\n \n \n yes sir!\n \n \n\nThe ``render_header`` method will generate the appropriate **, *