dennisreimann / uiengine

Workbench for UI-driven development
https://dennisreimann.github.io/uiengine/
MIT License
368 stars 25 forks source link

Custom script added to the uiengine.html template does not render #28

Closed luisjmontoro closed 6 years ago

luisjmontoro commented 6 years ago

Hello Dennis!

I'm trying to add a custom script to the uiengine.html template but it's not rendering. It's like any change I make to the template does not render when building the application.

The config.js is correct, though.

Any ideas on why this might be failing?

Thanks!

dennisreimann commented 6 years ago

Where can I see and reproduce this?

luisjmontoro commented 6 years ago

It is currently happening on our repo: https://github.com/alfonsomorcuende/thonet Thanks a lot!

dennisreimann commented 6 years ago

Hey Luis, sorry, but I cannot find a custom script or template that uses one in there. What exactly do you mean? What are you trying to accomplish and in which way does it fail?

luisjmontoro commented 6 years ago

I’m sorry Dennis, it is on this specific branch: https://github.com/alfonsomorcuende/thonet/tree/custom-script

I’m just trying to add a Google Analytics script, but it’s like the engine ignores any change I make to the template when rendering it.

dennisreimann commented 6 years ago

From what I can tell you don't seem to be rendering components. The "preview" template (uiengine.html) is used to embed the rendered html into a general page, which includes your scripts and styles.

It is not used for documentation pages, which you seem to be using exclusively. There is no way to inject scripts into the interface of the documentation, similar to the ui.customStylesFile config option.

Nevertheless: It seems you want to track the visitors of your Design System website, right? If so, see the config docs:

you can provide an analyticsId (from Google Analytics UA-XXX-X) to track the site

module.exports = {
  name: 'Thonet',
  analyticsId: 'UA-125556157-1'

  // ... rest of the config
}

Does this help?

luisjmontoro commented 6 years ago

Thank you so much, it seems that it works. I checked the config docs before but I should have missed that line. 🙃

dennisreimann commented 6 years ago

I checked the config docs before but I should have missed that line.

You know what – I had to search some myself. I knew it was in there, but thought it would be more intuitive to have this in the ui config section. I guess I'll move it there with the 2.0.

btw: Great job on your Design System docs – they look gorgeous!

luisjmontoro commented 6 years ago

Thank you so much!! :)) It is a work in progress idea yet :)