assemble relative page.dest not working after push to the server - handlebars.js

## version
"version": "0.1.0",
description
I am using relative page.dest to the path of my app, it is working fine perfect in my localhost.
http://localhost:9000/application/website/index.html
<li>link 1</li>
the problem is when I push this to the server: so in the server exist a folder before application for the project called: clientwebsite
wwww.server.com/clientwebsite/application/website/index.html
so when I click in the any links goes to: wwww.server.com/application/website/index.html (does not exist)
instead of wwww.server.com/clientwebsite/application/website/index.html
someone know how to solve this problem?

I was missing in the path the folder dist/
so I did like that:
<li>link 1</li>
now it is working perfectly

Related

CSS loading image with url() on windows gets path messed up

So i have this mountains.jpg which is in the root folder of the project that i want to load in the background.
My container has style={{ backgroundImage: `url(${path.resolve("mountains.jpg")})` }}
I have also a console.log(path.resolve("mountains.jpg")) which prints this on Linux:
/home/user/Documents/App/dist/linux-unpacked/mountain.jpg
and the image loads fine!
But then i install it on Windows and run the app.
The path printed is C:\Users\user\AppData\Local\Programs\app\mountains.jpg which i checked and the image was in the right place.
But then i get this error:
Failed to load resource: net::ERR_FILE_NOT_FOUND
file:///C:/UsersuserppDataLocalProgramsppmountains.jpg
which is very odd. The path seems all messed up when it is parsed by url(path)
If anyone knows a fix for this, i would be thankful to know.
My image is in the project root folder and my component in src/Component.js. I used a relative path from my component to the image, and the image could load fine.
So the problem was that after i used electron-builder, and ran the app in dist folder, the relative path was no longer valid, because the component now supposedly was one level deeper, as the console.log(path) showed me.
package.json build
"build": {
"appId": "com.app",
"files": [
"build/**/**/*",
"node_modules/**/*",
"./main.js"
],
"extraFiles": [
{
"from": ".",
"to": ".",
"filter": [
"*.jpg",
"*.png"
]
}
],
So i was telling electron-builder to target the image files in root and copy them over to the dist folder, but the relative path to the image changes. So i used full path using process.cwd() so in both cases it starts in root project folder then points to image from there.
But as the windows path gets bugged, i tried a different approach, which was removing the "extraFiles:" part from package.json, and then adding a file-loader module to Webpack.
Then, as suggested by other people, i added import image from '../mountains.jpg'
and then
<Component style={{ backgroundImage: `url(${image})` }}></Component>
And now it works on Windows too :)
The image won't be in the root folder tho, so to have the image shipped with the app and be available on the root folder, the extraFiles can still be used so the image gets copied over.

Correctly packaging CSS files for deployment to Azure CDN as part of Azure DevOps extension

I'm developing an Azure DevOps extension, which displays the a summary of work items for the current Sprint for printing.
I am failing to get static CSS files to publish correctly.
I have the following configured in the manifest.json in the files section:
{
"path": "css/print.css",
"contentType": "text/css",
"addressable": true
},
{
"path": "css/screen.css",
"contentType": "text/css",
"addressable": true
},
The structure of the project is:
css/screen.css
css/print.css
board-cards.html
vss-extension.json
Reading this documentation: https://learn.microsoft.com/en-us/azure/devops/extend/develop/static-content indicates that the static content should be published to: https://publisher.gallery.vsassets.io.
When debugging - the following two 404's appear in the network log:
https://publisher.gallerycdn.vsassets.io/css/print.css
https://publisher.gallerycdn.vsassets.io/css/screen.css
(I've changed my publisher account name to the generic "publisher" string for ease)
I've opened the .vsix in 7zip, and the folder and css files are in the package. After many hours of Googling and hunting through stackoverflow, I'm unable to find a solution.
I tried changing the entry in "files" to be simply:
{
"path": "css",
"addressable": true
}
However this had no effect.
Is anyone able to advise me on what I'm missing or doing wrong?
Through further debugging I've found that the files do exist under a URL specific the the version published.
e.g. https://publisher.gallerycdn.vsassets.io/extensions/publisher/board-cards/1.0.64/1545996658773/css/screen.css
And then I checked the mark-up, and I realised I'd made an absolute reference to the CSS files. E.g.
/css/screen.css
By removing the first slash - this made the reference to the CSS file relative, which solved the problem.
HTML 101.

Meteor for Windows in WebStorm

I am learning how to use Meteor in Windows (just installed the preview released last week). I'm using WebStorm
I ran through the instructions on page 1 of this tutorial (https://www.meteor.com/try) and can see the fully rendered website at http://localhost:3000. However, when I follow the instructions and paste the code directly from page 2 (https://www.meteor.com/try/2), the website does not load properly. The code is:
<!-- simple-todos.html -->
<head>
<title>Todo List</title>
</head>
<body>
<div class="container">
<header>
<h1>Todo List</h1>
</header>
<ul>
{{#each tasks}}
{{> task}}
{{/each}}
</ul>
</div>
</body>
<template name="task">
<li>{{text}}</li>
</template>
// simple-todos.js
if (Meteor.isClient) {
// This code only runs on the client
Template.body.helpers({
tasks: [
{ text: "This is task 1" },
{ text: "This is task 2" },
{ text: "This is task 3" }
]
});
}
The instructions say I should see:
Todo List
This is task 1
This is task 2
This is task 3
Instead, I see:
Todo List
{{#each tasks}} {{> task}} {{/each}}
Somehow the Meteor code is not being recognized. Am I missing a step? I thought it might have something to do with the Windows release, but the first case loaded fine.
Thank you.
Brendan
You don't need to run Vagrant or figure out Nitrous.io. Meteor and WebStorm work just fine on Windows. See the video at http://meteorpedia.com/read/Webstorm. You don't need to start meteor separately either.
Here's how to run the http://meteor.com/try example:
Install Meteor for Windows if you haven't already. If you have, delete the folder %USERPROFILE%\AppData\Local\.meteor and install the latest preview again.
Start WebStorm
Create a new project, choose type Meteor.js app, then "default".
Run -> Run -> Edit configurations
Click the + to add a new configuration of type Meteor
Call it simple-todos for clarity (this is optional)
Click Run
Notice how Webstorm starts a console within the IDE, which shows the familiar Meteor startup sequence:
=> Started proxy.
=> Started MongoDB.
=> Started your app.
=> App running at: http://localhost:3000/
If you're prompted for any firewall permissions, make sure to allow all traffic from Node.js.
Since you created the project from WebStorm, files won't be named simple-todos.*, but rather hello.*. I've just filed an issue about that.
Also, the steps to create a configuration won't be necessary, thanks to another issue that's been filed.
I used a virtualised solution to work with meteor on windows, for some reason the windows version of meteor don't work as expected, I got a lot of unexpected errors...
I suugest you to use vagrant with your WebStorm if you want to be on windows.
I made small video to show how it works with IntellijIdea and must be the same for WebStorm.
Here the video
https://www.youtube.com/watch?v=woFUR1dMZ3g

Problems with image path

I have a project built in CodeIgniter. In my localhost, the website work fine, but in the remote server, fail the image inclusion from CSS & JS.
The site, is guest in a subdomain. The server file system hierarchy is:
--/
---apps (subdomain folder for my app)
----application
----[other CI forlders]
----css
----js
----img
--[other web folders (no CI)]
--index.html
In CSS files i define the images paths this way: "../img/"
For example:
#maincontainer {background-image: url('../img/main_bg.gif');}
But, in Chrome and FF, show error to load resources:
Failed to load resource: the server responded with a status of 404
(Not Found) http://apps.manantiales.edu.ar/img/main_bg.gif
Any ideas?
You are on a subdomain, therefore, the correct path would be:
http://manantiales.edu.ar/apps/img/main_bg.gif
You can use rules in your htaccess file to make the subdomain path work
or
Just use absolute paths like diEcho suggested. You can embed php code in css files like this:
maincontainer {background-image: url('< ?php echo site_url('img/main_bg.gif');?>');}
(I have put an extraspace at < ?php as not sure how to format it to show correctly here)
You can simply do it like this
--/
---apps (subdomain folder for my app)
----application
----[other CI forlders]
--[other web folders (no CI)]
--index.html
--css
--js
--img
#maincontainer {background-image: url('../img/main_bg.gif');}
and in html files;
<?= base_url();?>css/css.css

convert .WAR for auto deploy in karaf/servicemix

I've got very simple .WAR containing example servlet. I'm able to deploy it in servicemix using the following command:
osgi:install file:///home/seiho/apache-servicemix-4.4.2/deploy/TestServlet.war?Bundle-SymbolicName=TestServlet&Webapp-Context=/TestServlet
And then see it in my browser. But only with full path to a file, e.g.: localhost:8080/TestServlet/index.html or localhost:8080/TestServlet/TestServlet (my servlet is TestServlet class).
I'd like to launch the index.html page automatically after entering: localhost:8080/TestServlet
how to do it?
MORE IMPORTANT
I need a way to convert the .WAR file or servlet project (I've got the sources) so that new .WAR file can be auto-deployed by copying it to $SERVICEMIX_HOME/deploy directory.
I've tried editing the MANIFEST.MF file, but with no success. Probably I'm doing something wrong.
Thanks for any advice/help.
To be recognised as a wab, you need to add a context path header to your manifest:
Web-ContextPath: TestServlet
It's working now! I was doing my MANIFEST.MF according to this page: http://team.ops4j.org/wiki/display/ops4j/Pax+Web+Extender+-+War+-+OSGi-fy
The problem was that for some reason "Bundle-Version: 1.0" line was required as opposed to optional as stated on that page.
Honestly, just adding the Bundle-Version fix-it.
I knew it was something wrong with the MANIFEST.MF and after Holly Cummins' question I played with it a bit more. Thanks Holly.
I still can't do anything with the manual site launching (have to manually enter the index.html).
http://localhost:8080/TestServlet/ gives me this:
HTTP ERROR 404
Problem accessing /TestServlet/. Reason:
Not Found
Powered by Jetty://
http://localhost:8080/TestServlet/index.html gives me proper site.

Resources