Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with multiple files #3

Closed
timkelty opened this issue Mar 3, 2015 · 12 comments
Closed

Not working with multiple files #3

timkelty opened this issue Mar 3, 2015 · 12 comments

Comments

@timkelty
Copy link

timkelty commented Mar 3, 2015

options: {
    templatePath: 'src/templates/',
    data: 'src/data/',
    punctuation: '',
  },
  dist: {
    files: {
      'dist/index.html': ['src/templates/index.tpl'],
      'dist/product.html': ['src/templates/product.tpl'],
      'dist/category.html': ['src/templates/category.tpl'],
    }
  }

All files get created, but all but dist/index.html are empty, no matter what they have in the src.

@timkelty
Copy link
Author

timkelty commented Mar 3, 2015

This seems to happen only when the files have an extends tag, e.g.:
{extends file='layouts/default.tpl'}

@hereandnow
Copy link
Owner

i'll look into it. got a lot of work at the moment, so this could take a few days.

@timkelty
Copy link
Author

timkelty commented Mar 3, 2015

Thanks, I appreciate it.

@hereandnow
Copy link
Owner

sorry for taking so long... as you have already noticed (a saw your opened issue on jsmart-repo) this is an error with jsmart itself. i'll close this issue for now. as long as jsmart isn't publishing a new major version, this should be incorporated automatically if fixed (dependency in package.json is "^2.13.0"

@Avcajaraville
Copy link
Contributor

I know this issue is closed, and I know its related to jsmart. I have posted an issue there, but the project seems not maintained anymore.

With this problem, how is this project even useful ? Isn't that one CAPITAL feature ?

Does anybody knows how to fix it (without modifying the src code) ?

@hereandnow
Copy link
Owner

Hi Avcajaraville,

i understand your point. I developed this Grunt-Plugin because i needed it for 1 File, so i did not recognize the issue in jsmart.

To fix it i only see 2 possible solutions:

  1. someone needs to ask the author of jsmart if he would make another one a contributor and give him the rights to publish jsmart to npm. then he can fix the issue there
  2. someone needs to fork jsmart, fix the bug and publish a version under a new name to npm so that i can change the dependency

i would to it, but my time is very very limited. if you are willing to do give it a try, go ahead, i will integrate if the bug is fixed!

@hereandnow
Copy link
Owner

I took a look into it, it should probably be fairly easy to fix:

just enable the "nocache" option param when calling getTemplate in the built-in extend parse function:

before:

getTemplate(trimQuotes(params.file?params.file:params[0]), tree);

after:

getTemplate(trimQuotes(params.file?params.file:params[0]), tree, true);

@Avcajaraville
Copy link
Contributor

Problem here is how to get this module updated. It doesn't expose anything, and in order to call that function, I will have to fork it, leaving all further support unavailable. I was thinking maybe the author fix it or there is anyway we can activate that option without overwriting the source code.

Thanks a lot for your answer :)

@hereandnow
Copy link
Owner

i dont see any possibility to do this without forking and merging back/or creating a new npm-module from it. the extend-functionality is not exposed, so "monkey-patching" it is not an option

go ahead and try to fork and make a pull request, maybe he answers... if not publish a module like "jsmart-multiextend" and i will integrate that one

@Avcajaraville
Copy link
Contributor

@hereandnow

I just created a fork and send a pull request.

You can introduce this fork on your package.json as dependency by referencing it like:

"jsmart": "Avcajaraville/jsmart#master"

Waiting for updates on the original repository owner.

@hereandnow
Copy link
Owner

done, and published v0.1.4: https://www.npmjs.com/package/grunt-jsmart

would be great if you ping me when the owner merged your pull request

@Avcajaraville
Copy link
Contributor

@hereandnow

You can count with that, as soon as it gets merge (or dismiss, or whatever), I will ping you :)

Thanks for merge it !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants