juliencabanes / requirejs-tpl Goto Github PK
View Code? Open in Web Editor NEWRequireJS Template Plugin
RequireJS Template Plugin
At least is now req.nameToUrl() has changed to req.toUrl().
And for some reason adding 'tpl!navigation.html' throws error "navigation.js" not found!
When using requirejs-tpl with r.js the created functions insert into the produced templates whitespaces at the beginning and at the end of the result.
This can result in some nasty problems depending on your css.
To solve this problem it's sufficient to modify line 53 from
+ "');}return __p.join('');";
to
+ "');}return __p.join('').trim();";
Is this a bug or the intended behaviour ?
PS: Thanks for the great plugin. It is really useful
Currently having this error, when running mvn brew:optimize:
js: Error: Error evaluating module "undefined" at location "undefined":
Error in file: /.../requirejs.plugins/tpl-0.24.0.js. Conditional comment: //>>excludeStart('excludeTpl', pragmas.excludeTpl)
failed with this error: TypeError: Cannot read property "excludeTpl" from null
fileName:undefined
lineNumber: undefined
http://requirejs.org/docs/errors.html#defineerror (/var/folders/kd/nhdzps716w78sf3nhsgn3mw80000gn/T/build6149642382638994696js#7606)
pom.xml settings looks like this:
<plugin>
<groupId>com.voltvoodoo</groupId>
<artifactId>brew</artifactId>
<version>0.2.10</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>optimize</goal>
</goals>
</execution>
</executions>
<configuration>
<optimizeSourceDir>${basedir}/src/main/webapp</optimizeSourceDir>
<optimizeBuildDir>${basedir}/src/main/webapp</optimizeBuildDir>
<optimizeOutputDir>${basedir}/src/main/webapp</optimizeOutputDir>
<!-- Set this to do auto-compilation when a file is changed <watch>true</watch> -->
</configuration>
</plugin>
I just saw the excludeTpl feature in your demo file.
The feature is quite cool and I think you should definitely add a short note to your readme.
pragmasOnSave:{excludeTpl:true}
I am using the namespace option with r.js and it does not rename the tpl define statements.
eg:
define('tpl!templates") ---> namespace.define('tpl!templates")
Everything works fine when using node for bundling, with command:
node build/r-2.0.2.js -o build/booking.build.js
But when doing same with java and rhino like this:
java -classpath build/js.jar:build/compiler.jar org.mozilla.javascript.tools.shell.Main build/r-2.0.2.js -o build/booking.build.js
I get following error:
Tracing dependencies for: booking
TypeError: Cannot call property get in object [object Object]. It is not a function, it is "undefined".
In module tree:
booking
initDom
tpl
TypeError: Cannot call property get in object [object Object]. It is not a function, it is "undefined".
In module tree:
booking
initDom
tpl
I'm using latest version of closure compiler and rhino.
Version of require.js is 2.0.4 and r.js 2.0.2
Version 2.0.2 of r.js is the latest version which worked with tpl plugin. At least versions between 2.0.3 and 2.0.6 are no more compatible with this plugin.
With version 2.0.6 of r.js I get the following error when compiling with following command:
$ node build/r-2.0.6.js -o build/booking.build.js
Tracing dependencies for: booking
Error: EBADF, Bad file descriptor '/vendor/requirejs.plugins/tpl-0.24.0.js'
In module tree:
booking
initDom
Error: EBADF, Bad file descriptor '/vendor/requirejs.plugins/tpl-0.24.0.js'
In module tree:
booking
initDom
at Object.openSync (fs.js:221:18)
see text.js: https://github.com/requirejs/text/blob/b57d66a8aa705c4dcd4959ced3be2cbda7e76183/text.js#L255
var file = fs.readFileSync(url, 'utf8');
//Remove BOM (Byte Mark Order) from utf8 files if it is there.
if (file[0] === '\uFEFF') {
file = file.substring(1);
this would be great, because escaped output is often necessary!
We at VersionEye are working hard to keep up the quality of the bower's registry.
We just finished our initial analysis of the quality of the Bower.io registry:
7530 - registered packages, 224 of them doesnt exists anymore;
We analysed 7306 existing packages and 1070 of them don't have bower.json on the master branch ( that's where a Bower client pulls a data ).
Sadly, your library ZeeAgency/requirejs-tpl
is one of them.
Can you spare 15 minutes to help us to make Bower better?
Just add a new file bower.json
and change attributes.
{
"name": "ZeeAgency/requirejs-tpl",
"version": "1.0.0",
"main": "path/to/main.css",
"description": "please add it",
"license": "Eclipse",
"ignore": [
".jshintrc",
"**/*.txt"
],
"dependencies": {
"<dependency_name>": "<semantic_version>",
"<dependency_name>": "<Local_folder>",
"<dependency_name>": "<package>"
},
"devDependencies": {
"<test-framework-name>": "<version>"
}
}
Read more about bower.json on the official spefication and nodejs semver library has great examples of proper versioning.
NB! Please validate your bower.json with jsonlint before commiting your updates.
Thank you!
Timo,
twitter: @versioneye
email: [email protected]
VersionEye - no more legacy software!
Hi,
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/with
"Using with is not recommended, and is forbidden in ECMAScript 5 strict mode."
I was wondering if there is a way to avoid using with
as my closure compiler makes 270 verbose warnings about it and it fails in strict mode. Also the lookups needed make the execution slower.
Is there any 'automagic' way of appending the context variable to the references in the template or do you think the only way around this is to manually append a 'special' variable like ctx
when referencing variables from the view in the template?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.