Skip to content

Loading…

Component generator adds invalid string to index.html #54

Closed
saschakiefer opened this Issue · 2 comments

2 participants

@saschakiefer

When the component controller doesn't find the comment /* endOfResources */ in index.html, it adds sap.ui.localResources( "myDir" ); at the beginning of index.html.
if the hook isn't found, the generator should do nothing.

@saschakiefer saschakiefer added this to the 0.2.1 milestone
@saschakiefer saschakiefer added the bug label
@saschakiefer saschakiefer self-assigned this
@saschakiefer saschakiefer was unassigned by js1972
@js1972 js1972 self-assigned this
@js1972
Collaborator

We only want to use sap.ui.localResources( "myDir" ); on a classic app. For the Fiori-like apps that use the component model we use the UI5 bootstrap tag to specify resource roots instead.

So we need to detect what sort of app the new component is being generated in. If its classical then use this.addLocalResource(this.componentName);; if its fiori-like then skip this and ....

a) Do we need to add a new resource root? We don't if we are going to prefix the component name with the apps namespace as it already has that resource root defined.

b) If we don't prefix the component name with the apps namespace then we would need to add the component name as a resource root.
(the above two options depend on issue #47.)

@js1972 js1972 added a commit to js1972/generator-openui5 that referenced this issue
@js1972 js1972 feat(Components): Handle component namespaces
Handle component namespaces:
 - Prompt for application architecture in uiComponent generator (will be refactored to be automatic later)
 - If application.js style then use addLocalResource()
 - If Component style then use new function: addResourceRoot() (this is still a work in progress for formatting the index.html)
 - Fix issue that the rewrite function in utils.js doesn't handle files that use tabs instead of spaces

Fixes #47 #54 #55
793a582
@saschakiefer

Even though the generator checks for Application.js or Component.js, I still want to add a check if the heystack is found.

@js1972 js1972 added a commit to js1972/generator-openui5 that referenced this issue
@js1972 js1972 fix(rewrite): Handle needle not found error in rewrite function.
Throw exception - handled by current default handler - when the needle is not found in the rewrite fucntion.

Fixes #54
f15f72f
@js1972 js1972 added a commit to js1972/generator-openui5 that referenced this issue
@js1972 js1972 fix(rewrite): improve error message when needle not found error.
fixes #54
9a06acc
@js1972 js1972 added a commit to js1972/generator-openui5 that referenced this issue
@js1972 js1972 refactor(sub-gen): Refactor error handling when writing resource root…
…s from the component sub-generator

Fixes #54 #55
fd8402e
@js1972 js1972 closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.