johnsoftek / plugin-jade Goto Github PK
View Code? Open in Web Editor NEWJade loader plugin for jspm
License: MIT License
Jade loader plugin for jspm
License: MIT License
I get the following error when using extends
Error: Jade:1
> 1| extends core/_layout.jade
2|
the "filename" option is required to use "extends" with "relative" paths
at Parser.resolvePath (http://localhost:8080/jspm_packages/npm/[email protected]/lib/parser.js:486:13)
at Parser.parseExtends (http://localhost:8080/jspm_packages/npm/[email protected]/lib/parser.js:505:21)
at Parser.parseExpr (http://localhost:8080/jspm_packages/npm/[email protected]/lib/parser.js:221:21)
at Parser.parse (http://localhost:8080/jspm_packages/npm/[email protected]/lib/parser.js:122:25)
at parse (http://localhost:8080/jspm_packages/npm/[email protected]/lib/index.js:104:21)
at Object.exports.compileClientWithDependenciesTracked (http://localhost:8080/jspm_packages/npm/[email protected]/lib/index.js:256:16)
at Object.exports.compileClient (http://localhost:8080/jspm_packages/npm/[email protected]/lib/index.js:289:18)
at eval (http://localhost:8080/jspm_packages/github/johnsoftek/[email protected]/jade.js!transpiled:113:30)
Uncaught (in promise) Error: (SystemJS) Cannot read property '_handle' of undefined
TypeError: Cannot read property '_handle' of undefined
at eval (http://localhost:3000/jspm_packages/npm/[email protected]/tools/node.js:3:15)
at Array.forEach (native)
at Object.eval (http://localhost:3000/jspm_packages/npm/[email protected]/tools/node.js:2:34)
at eval (http://localhost:3000/jspm_packages/npm/[email protected]/tools/node.js:263:4)
at eval (http://localhost:3000/jspm_packages/npm/[email protected]/tools/node.js:264:3)
Evaluating http://localhost:3000/jspm_packages/npm/[email protected]/tools/node.js
Evaluating http://localhost:3000/jspm_packages/npm/[email protected]/lib/transformers.js
Evaluating http://localhost:3000/jspm_packages/npm/[email protected]/lib/filters.js
Evaluating http://localhost:3000/jspm_packages/npm/[email protected]/lib/parser.js
Evaluating http://localhost:3000/jspm_packages/npm/[email protected]/lib/index.js
Error loading http://localhost:3000/jspm_packages/github/johnsoftek/[email protected]/jade.js
Error loading http://localhost:3000/Home/home.jade!http://localhost:3000/jspm_packages/github/johnsoftek/[email protected]/jade.js as "./home.jade!" from http://localhost:3000/Home/home.component.ts
Using: [email protected]
Stack trace:
Error: (SystemJS) fs.realpathSync is not a function
TypeError: fs.realpathSync is not a function
at eval (http://localhost:8100/jspm_packages/npm/[email protected]/tools/node.js:36:38)
at Array.map (native)
at Object.eval (http://localhost:8100/jspm_packages/npm/[email protected]/tools/node.js:35:3)
at eval (http://localhost:8100/jspm_packages/npm/[email protected]/tools/node.js:166:4)
at eval (http://localhost:8100/jspm_packages/npm/[email protected]/tools/node.js:167:3)
Evaluating http://localhost:8100/jspm_packages/npm/[email protected]/tools/node.js
Evaluating http://localhost:8100/jspm_packages/npm/[email protected]/lib/transformers.js
Evaluating http://localhost:8100/jspm_packages/npm/[email protected]/lib/filters.js
Evaluating http://localhost:8100/jspm_packages/npm/[email protected]/lib/parser.js
Evaluating http://localhost:8100/jspm_packages/npm/[email protected]/lib/index.js
Error loading http://localhost:8100/jspm_packages/github/johnsoftek/[email protected]/jade.js
Error loading http://localhost:8100/app/directives/document_uploader/document_uploader.jade as "./document_uploader.jade" from http://localhost:8100/app/directives/document_uploader/document_uploader_directive.js
Import statement:
import { html as template } from './document_uploader.jade';
jspm config:
"meta": {
"*.jade": {
"loader": "jade"
},
when calling builder.buildSFX()
[04:31:59] 'requirejs:setup' errored after 2.39 s
[04:31:59] Error: Error: /code/frontend/node_modules/systemjs-builder/node_modules/systemjs/dist/system.src.js:2798
throw new Error('Module not already loaded loading "' + names + '" f
^
Module not already loaded loading "fs" from "undefined".
Evaluating file:///code/frontend/.gulp-build/jspm_packages/github/johnsoftek/[email protected]/jade.js
Evaluating file:///code/frontend/.gulp-build/jspm_packages/github/johnsoftek/[email protected]
Error loading file:///code/frontend/.gulp-build/jspm_packages/github/johnsoftek/[email protected]
at formatError (/home/rush/.nvm/v0.12.7/lib/node_modules/gulp/bin/gulp.js:169:10)
at Gulp.<anonymous> (/home/rush/.nvm/v0.12.7/lib/node_modules/gulp/bin/gulp.js:195:15)
at Gulp.emit (events.js:107:17)
at Gulp.Orchestrator._emitTaskDone (/home/rush/.nvm/v0.12.7/lib/node_modules/gulp/node_modules/orchestrator/index.js:264:8)
at /home/rush/.nvm/v0.12.7/lib/node_modules/gulp/node_modules/orchestrator/index.js:275:23
at finish (/home/rush/.nvm/v0.12.7/lib/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:21:8)
at /home/rush/.nvm/v0.12.7/lib/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:45:4
at lib$rsvp$$internal$$tryCatch (/code/frontend/node_modules/systemjs-builder/node_modules/rsvp/dist/rsvp.js:493:16)
at lib$rsvp$$internal$$invokeCallback (/code/frontend/node_modules/systemjs-builder/node_modules/rsvp/dist/rsvp.js:505:17)
at lib$rsvp$$internal$$publish (/code/frontend/node_modules/systemjs-builder/node_modules/rsvp/dist/rsvp.js:476:11)
Ive installed you Plugin and setup jspm with babel.
import tpl from 'dash.jade!';
console.log(tpl());
brings me
GET http://127.0.0.1:8080/jspm_packages/npm/[email protected] 404 (Not Found)
Any ideas whats wrong here?
I was just wondering if there is a roadmap or timeline for converting this plugin to use Pug?
It could be good to load the runtime with:
var runtime = "var jade = require(" + module.id + "/jade-runtime);\n\n";
This way, you're not assuming the plugin name (jade), and are inserting it dynamically.
Also, having the runtime as a separate require means that the full compiler won't be built into the bundle for production.
Hi!
We are using plugin and found that support for 'jade include" is in master.
Could you please make a release?
In my code I always have to call the function for every import I do of a jade file; it would be nice to have an option to pass plugin-jade where it returns the already called function. An Angular 2 example is:
import {Component} from 'angular2/core';
import template from './app.component.jade';
@Component({
selector: 'app',
template: template()
})
export class AppComponent {
constructor() { }
}
It would be nice if I just had to do this:
import {Component} from 'angular2/core';
import template from './app.component.jade';
@Component({
selector: 'app',
template: template
})
export class AppComponent {
constructor() { }
}
Without the parens for every template I import. Maybe have an option in the jspm config for this.
Thanks.
Since jspm 0.16.1
bundles including jade
templates seem to be broken.
Using such a bundle results in:
Error: Module undefined not declared as a dependency.
Error loading http://localhost:8000/index.js
at http://localhost:8000/jspm_packages/system.js:4:21254
at http://localhost:8000/build.js:16:14
at u (http://localhost:8000/jspm_packages/system.js:4:21145)
at i (http://localhost:8000/jspm_packages/system.js:4:20761)
at http://localhost:8000/jspm_packages/system.js:4:21223
at http://localhost:8000/build.js:6:3
at u (http://localhost:8000/jspm_packages/system.js:4:21145)
at a (http://localhost:8000/jspm_packages/system.js:4:19710)
at Object.Promise.all.then.execute (http://localhost:8000/jspm_packages/system.js:4:24206)
at b (http://localhost:8000/jspm_packages/system.js:4:8159)
The generated bundle looks like this:
System.registerDynamic("index.js", ["index.jade!github:johnsoftek/[email protected]"], true, function(require, exports, module) {
;
var global = this,
__define = global.define;
global.define = undefined;
require("index.jade!github:johnsoftek/[email protected]");
global.define = __define;
return module.exports;
});
System.registerDynamic("index.jade!github:johnsoftek/[email protected]", [], true, function(require, exports, module) {
;
var global = this,
__define = global.define;
global.define = undefined;
var jade = require("undefined");
module.exports = function template(locals) {
var buf = [];
var jade_mixins = {};
var jade_interp;
;
return buf.join("");
};
global.define = __define;
return module.exports;
});
//# sourceMappingURL=build.js.map
Note the require("undefined")
.
[Ref: jspm/jspm-cli#1047]
Here is my config:
SystemJS.config({
typescriptOptions: {
"tsconfig": true
},
transpiler: "plugin-typescript",
packages: {
"app": {
"main": "main",
"format": "system",
"defaultExtension": "ts",
"meta": {
"*.ts": {
"loader": "plugin-typescript"
},
"*.jade": {
"loader": "plugin-jade"
}
}
}
}
});
For importing I have:
import jadeTemplate from './app.component.jade'; (tried with jade! too)
and getting:
system.src.js:5031 GET http://127.0.0.1:8080/plugin-jade 404 (Not Found)X @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031
Error: Error: XHR error (404 Not Found) loading http://127.0.0.1:8080/plugin-jade
Error loading http://127.0.0.1:8080/plugin-jade
Error loading http://127.0.0.1:8080/src/app/app.component.jade as "./app.component.jade" from http://127.0.0.1:8080/src/app/app.component.ts
Hi,
Any idea how can I config Karma (karma.conf.js) to support js files that import jade files through plugin-jade.
I've tried using karma-jade-preprocessor
but with no luck I get Uncaught Error loading "app/app.jade!github:johnsoftek/[email protected]"
here is my conf file for reference: https://gist.github.com/gavriguy/7c55db0263ef367787aa/ca4547dd05a878f73dbc2c64e97a37d2d0a0a2f6
System.normalize('jade-compiler') now returns [email protected]
rather than [email protected]
.
Solution: to locate Jade runtime, we can use System.normalize('jade-compiler/lib/runtime')
Following along here for creating a bundle:
https://github.com/jspm/jspm-cli/blob/master/docs/production-workflows.md#creating-a-bundle
Does not seem to work with plugin-jade.
I get this error:
system.src.js:5031 XMLHttpRequest cannot load file:///Users/name/project/jspm-babel/jspm_packages/npm/[email protected]/lib/runtime.js. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.X @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031(anonymous function) @ system.src.js:5031
Error: Error: XHR error loading file:///Users/name/project/jspm-babel/jspm_packages/npm/[email protected]/lib/runtime.js(โฆ)
When I copy the file path, it opens the file fine, so not sure why it isn't working.
Thanks.
I'm trying to use the plugin with jspm 0.17.0-beta.13 and I'm getting this error whenever I try to import a file using:
import template from './app.jade'
output:
err Error on translate for myproject/app.jade at file:///Users/g/Desktop/myproject/src/app.jade Loading myproject/app.js TypeError: Cannot read property 'builder' of undefined at file:///Users/g/Desktop/myproject/jspm_packages/github/johnsoftek/[email protected]/jade.js!transpiled:10:16
This is my jspm.config.js top block configuration.
SystemJS.config({ transpiler: "plugin-babel", packages: { "myproject": { "main": "app.js", "meta": { "*.js": { "loader": "plugin-babel" } } } }, meta: { "*.jade": { "loader": "jade" } } });
Also I don't believe this is in the realm of the plugin itself but is there a way to make watchman catch any changes to the jade files and compile if you're using the new jspm bundle src/app.js -wid
command?
If you need any further clarification let me know.
Thank you so much!
Hi,
Currently I have an error when I trying to include one jade to another.
here is the log
2| type="text/ng-template"
3| id="kg-courieriser-level-list-template.html" )
> 4| include ./par/kg-courieriser-level-list-template.jade
5| script(
6| type="text/ng-template"
7| id="kg-courieriser-level-form-template.html" )
the "filename" option is required to use "include" with "relative" paths
at Parser.resolvePath
Its because the plugin using jade.compile()
but its not passing current filename
or basedir
to the compiler. Is there any way how I can force to render this subtemplate?
Getting the following error with beta 15:
h2_app.js:4 Potentially unhandled rejection [4] Error: Invalid JSON file https://www.h2.dev/jspm_packages/github/johnsoftek/[email protected]
Error loading https://www.h2.dev/jspm_packages/github/johnsoftek/[email protected]
Error loading https://www.h2.dev/client/app/home/home.jade as "./home.jade" from https://www.h2.dev/client/app/home/home.module.js
Seems like plugin-text is having issues, too: jspm/jspm-cli#1848
All I did was npm uninstall jspm and then npm install jspm@beta --save-dev
When ever I run jspm install
it will install jade into jspm_packages/npm/[email protected]
however the file for jade doesn't get created like it should because I'm getting an 404 error because jspm_packages/npm/[email protected]
doesn't exist. If I create that file and add the following contents it works correctly.
// jspm_packages/npm/[email protected]
module.exports = require('npm:[email protected]/lib);
I think this might be an issue with JSPM it's self so you might need to open an issue with them but since running jspm install jade
installs this lib I figured I'd open the issue here.
I get the follow error when I run jspm bundle
Potentially unhandled rejection [6] TypeError: Error loading "templates/posts.jade!github:johnsoftek/[email protected]" at <unknown>
Error loading "templates/posts.jade!github:johnsoftek/[email protected]" from "js/app" at file:/Users/David/Aranja/aranja.com/app/js/app.js
Error loading "github:johnsoftek/[email protected]/jade-compiler.min" at file:/Users/David/Aranja/aranja.com/app/jspm_packages/github/johnsoftek/[email protected]/jade-compiler.min.js
Execution must define a Module instance
I'm calling the module as follows
import template from 'templates/posts.jade!'
export default data => data.forEach(post => {
var element = document.getElementById('facebook-feed')
element.innerHTML = template({
posts: data
})
})
Possibly related issue systemjs/builder#22
In my project I wanted to use plugin-jade with jspm version 0.14.0. After 'jspm install', regarding to plugin-jade readme file I tried to build bundled script that uses your plugin. It fails. I am working on Windows 7. When I tried on Linux- it works.
Here is message from terminal:
D:\projects\maps\jspm_packages\github\johnsoftek\[email protected]>jspm bundle app
Configuration file config.js doesn't exist, create it? [yes]:
Building the bundle tree for app...
err Error: Error loading "test.jade!jade" at <unknown>
Error loading "test.jade!jade" from "app" at file:D:\projects\maps\jspm_packages\github\johnsoftek\[email protected]/app.js
Error loading "jade-compiler" at file:D:\projects\maps\jspm_packages\github\johnsoftek\[email protected]/jade-compiler.js
Error loading "jade-compiler" from "jade" at file:D:\projects\maps\jspm_packages\github\johnsoftek\[email protected]/jade.js
ENOENT, open 'D:\projects\maps\jspm_packages\github\johnsoftek\[email protected]\jade-compiler.js'
I'm trying to require jade
var listTemplate = require('./list-template.jade!');
but what I've got in console.log is
GET http://localhost:8000/static/kg/jade.js 404 (NOT FOUND)
Do I need to setup config.js to make it work?
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.