Open adriatic opened 8 years ago
Few hour later I discovered what gave me grief:
!
character in <require from="kendo-ui/src/styles/web/kendo.bootstrap.css!"></require>
results with a very confusing error message:
Error loading http://localhost:9000/jspm_packages/github/telerik/kendo-ui-core@2015.3.1111/src/styles/web/kendo.bootstrap.css!http://localhost:9000/dist/css.js
Removal of the !
improves" this same message to
Unhandled promise rejection Error: XHR error (404 Not Found) loading http://localhost:9000/jspm_packages/github/telerik/kendo-ui-core@2015.3.1111/src/styles/web/kendo.bootstrap.css
My actual problem: because of too long fiddling with the "pathname" to the folder that contains the .css
file, I failed to see how that folder does not contain the .css
files any more - they are replaced by .less
files in the new (few days old) KendoUI distribution at https://github.com/telerik/kendo-ui-core
I decided not to delete this issue, as I genuinely believe that there is a need for a "consistency checker" which would explain to me my specific issue in real time - including the fact that there is no .css file in the folder I am trying to access (as different from the path to that folder being wrong)
I am writing this with lots of details expecting that you might use parts of my text to improve the existing documentation :-)
The process of defining references to "third party" css files has too many degrees of freedom, making it feel as a trap - in my own experience this is the most confusing areas of Aurelia and it needs help both in cheat-sheet document and the
templating
debug output.To show the problem, I will contrast the well known method of providing access to
bootstrap
in skeleton navigation application with my own problem of providing the access toKendoUI
- where both bootstrap and KendoUI "live" in Github.Accessing bootstrap from Github
Step 1: Declare application dependency on bootstrap by this line
in
jspm
section of the application's package.json file. This dependency creates the mapping between the application's internal name (bootstrap) and external name (github:twbs/bootstrap@^3.3.5) for the GitHub repository accessed by URL https://github.com/twbs/bootstrap.git (Note the absence of the version number in the URL itself - I will come back to KendoUI case later)Since the
package.json
file is processed byjspm
, the above defined information is persisted in the jspm generated config.js file here using the same format aspackage.json
shown above.Step 2: Add bootstrap to skeleton navigation app Once the initial installation step
npm install
successfully executed, the whole bootstrap module is added to the skeleton navigation app by executing the command that installs the client side dependencies:Note: this form of invoking the installation of the client side dependencies (without the
-y
argument) results with additional benefit of getting immediate warnings on any "version overwrites" that often get unnoticed and result with difficult debugging later).Accessing bootstrap from inside (the skeleton navigation app)
_Editorial_ This is where the first chance for confusion exists as there are too many variants of ES6 import statement, which combined with the mapping of the internal and external names discussed in previous section can result with unnecessary complexity.
In addition to above (Aurelia independent) issues, Aurelia added the
<require>
HTML element as an additional method of providing access to a third party css file. Since this "private"<require>
element is processed by the templating compiler, this issue is being added to templating issues.The use of the
<require>
element is shown in app.html - line 3The difficulty with the format
<require from="bootstrap/css/bootstrap.css"></require>
is in the need for the developer to maintain the relationship between the first component of the string "bootstrap/css/bootstrap.css" with the mapping defined in thepackage.json
file discussed earlier.In addition I would recommend adding the explanation (in the form of comments) stating why is ES6 format of
import
statement used in the main.jsThis explanation should include the reason why is this import statement present in this file (as it is not obvious in my opinion) and how does the string 'boostrap' relate to the bootstrap module already installed in the skeleton application.
With all this huge introduction (provided for clarity and possible reuse in a different context), here is the problem with accessing KendoUI via
https://github.com/telerik/kendo-ui-core
Using the identical approach described for boostrap acces, where the
app.html
file isrunning my app results with
Clearly the external / internal name mapping is bad as shown by
The only difference that I could see is the existence of the highlighted line shown below:
which says
and absence of a similar information in the case of KendoUI: