Coder Social home page Coder Social logo

ejs-simple-loader's People

Contributors

carlsagan21 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ejs-simple-loader's Issues

pass object to .ejs

Hi , I am trying to pass object to .ejs through ejs-simple-loader

if object has two property , will get error

const testObj = { title: 'Fusion Net', name: 'Toby' };

but if object only have one property , will success

const testObj = { name: 'Toby' };

new HtmlWebpackPlugin({
    template: 'ejs-simple-loader?data=' + ${JSON.stringify(testObj)} + '!./src/views/index.ejs', 
}),

get variable from .ejs
<title> <%= JSON.parse(data).name %></title>

error log

ERROR in ./~/ejs-simple-loader?data={"title":"Fusion Net","name":"Toby"}!./src/views/index.ejs
    Module build failed: TypeError: src/views/index.ejs:1
     >> 1| <% include ./header.ejs %>

esc is not a function
at rethrow (/Users/luhua/Project/FusionNet/node_modules/ejs-simple-loader/node_modules/ejs/lib/ejs.js:285:18)
at eval (eval at compile (/Users/luhua/Project/FusionNet/node_modules/ejs-simple-loader/node_modules/ejs/lib/ejs.js:524:12), <anonymous>:20:9)
at eval (eval at compile (/Users/luhua/Project/FusionNet/node_modules/ejs-simple-loader/node_modules/ejs/lib/ejs.js:524:12), <anonymous>:22:10)
at returnedFn (/Users/luhua/Project/FusionNet/node_modules/ejs-simple-loader/node_modules/ejs/lib/ejs.js:555:17)
at Object.ejsSimpleLoader (/Users/luhua/Project/FusionNet/node_modules/ejs-simple-loader/index.js:32:47)

thanks for your helping

Cannot read property 'ejsSimpleLoader' of undefined

I'm getting the following output when trying to use this loader for my *.ejs file:

ERROR in ./main/frontend/index-dev.ejs (./node_modules/ejs-simple-loader!./main/frontend/index-dev.ejs)
Module build failed (from ./node_modules/ejs-simple-loader/index.js):
TypeError: Cannot read property 'ejsSimpleLoader' of undefined

The problem seems to be around these lines:

var configKey = loaderOptions.config || 'ejsSimpleLoader';
var globalOptions = this.options[configKey] || {};

If I change them to this, it works:

var configKey = loaderOptions.config || 'ejsSimpleLoader';
var globalOptions = this.options ? this.options[configKey] : {};

The problem is that this.options comes in as undefined, and I'm not sure why. There's another project where I work that appears to be set up identically, but when it gets to this point, its this.options is defined as:
{ output: { filename: 'index.html', publicPath: undefined } }

How does this library set this.options and how can I fix this?

get variable from ejs-simple-loader

Hi,
How can I get the variable from ejs-simple-loader in .ejs file

it's my config

new HtmlWebpackPlugin({ filename: './views/index.html', template: 'ejs-simple-loader?title'+ 'toby' +'!./src/views/index.ejs', inject: 'body', hash: true, chunks: ['index'], alwaysWriteToDisk: true, })

Am i right?
<title><%= title %></title>

thanks for your help ๐Ÿ‘ฏโ€โ™‚๏ธ

It's not working on webpack2

webpack:2.3.3

Error:

ERROR in   Error: Child compilation failed:
  Module build failed: TypeError: Cannot read property 'config' of null
  
  
  - TypeError: Cannot read property 'config' of null

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.