I've got a Dart application that consists of both client and server components. There are a couple of source files that are needed by both client and server. I'm trying to find a way to share them effectively without publishing a library to pub.
I've read through these docs but it doesn't say how to share a library if you don't want to publish it to pub. I'd like to do something like:
import 'package:../../Shared/lib/shared.dart';
But that doesn't work ("Target of URI does not exist").
What options do I have here?
Ah, I figured it out. I have to declare a dependency in my pubspec.yaml like this:
shared:
path: ../shared
Then I can just do this:
import 'package:shared/shared.dart';
Related
I am working on a NopCommerce website and have quite a bit of site-wide customization so I have created a plugin to handle it all but not sure on how to handle the localization. I see there are a couple of ways of updating the Localization strings, one way I have found is in the Plugin's Install() method:
this.AddOrUpdatePluginLocaleResource("Plugins.Payments.PayPalStandard.Fields.AdditionalFee", "Additional fee");
This looks like it only adds new resource strings for the plugin, is there a similar way to update the other resources via the Install() method like:
Admin.Catalog.Products.List.DownloadPDF
I found that there is a way to export the entire language to a language_pack.xml file, would it be better to just create an entire language pack instead? Is there a way to add a new language pack from the plugins Install() method?
I guess I could simply open the language_pack.xml file and add each resource found using the AddOrUpdatePluginLocaleResource, I was hoping that there was a built-in way of doing this using NopCommernce functionality.
Thanks!
As #Raphael suggested in a comment, provide a language pack along with plugin file to the end users, and give an option to upload required resource file within your plugin configuration page.
As per as I know, there is no inbuilt way to add language pack on plugin installation, but you can do some code on plugin install method to find language pack file(s) from plugin folder and install it, not quite sure, you can take reference of inbuilt methods.
I have some variables that depend on the environment. They don't belong to a deps library but the only way I know is to import them like if they were.
I import them them in config.exs like this:
config :martin,
url: "http://localhost:4001"
I then define the different urls for production and staging in staging.exs and prod.exs and it is working fine.
But I get this warning for each of the variables I import this way
You have configured application :martin in your configuration
file, but the application is not available.
This usually means one of:
1. You have not added the application as a dependency in a mix.exs file.
2. You are configuring an application that does not really exist.
Please ensure :martin exists or remove the configuration.
Is there a way to do it in a more correct way that won't trigger a warning?
You can use the name of your app instead...
config :my_app,
martin_url: "http://localhost:4001"
There is a mention in the docs of using the logging package to create a proper logger service. Given the features in the logging package it would be nice to be able to get the angular component tree as the logger full name.
I tried to play a bit with the dependency injection system to get the injector tree, so that I could reconstruct the app structure for the loggers. But this proved to be too tricky.
Is there a way to do this, or alternatively, is there a canonical logger service that I could use? It seems to be a pretty basic feature so it must be available somewhere.
I'd look at the logging package for help here.
This is not Angular-specific, but it supports tested loggers.
In Vane Roadmap:
Better support for running Vane on localhost. Right now it's certainly
possible to run Vane on localhost, but it's a little bit tricky. On
DartVoid we autogenerate a dart based server using the http_server
package. And all you need to initialize a Vane class is a standard
HttpRequest object. So, this will come soon hopefully. You can find
your autogenerated server.dart file at the root of you app if you have
a DartVoid app (it's not generated if you use a different framework).
I've created Guestbook sample application and file server.dart was missing.
Is Guestbook sample DartVoid app?
Can I reach generated server.dart file via GitHub?
Is there another way to reach this file?
Please create tags for Vane and DartVoid...
File can be reached from application:
import 'dart:async';
import 'dart:io';
import 'package:vane/vane.dart';
String collectionName = "posts";
class GetAllPosts extends Vane {
Future main() {
log.info("Guestbook : GetAllPosts");
new File("server.dart").readAsString().then((String fileContent){
log.info(fileContent);
});
return end;
}
}
Content of file will appear in system console in http://manage.dartvoid.com
TL;DR
Vane doesn't need an auto-generated server.dart file anymore, which makes it super easy to use.
Long answer
As the co-founder of DartVoid and a co-author of Vane maybe I can give a small update on how we have improved Vane's routing.
We have since the OP's question moved away from auto-generating a server file and instead we use annotations to declare Routes. At startup we parse these routes to build the 'routing table'.
If you're interested in knowing the gritty details and see a couple of examples, I recommend that you head over to the project repository at:
https://github.com/DartVoid/Vane
Currently I'm connecting to my meteor project using http://localhost:3000 which uses my meteorApp.html file.
How could I make Meteor respond to the following url:
http://localhost:3000/otherPath ?
To be more explicit, I do have a file on the server side I just would like to be able to retrieve on the client side using http://localhost:3000/nameOfTheFile.sufix
I think you can just put nameOfTheFile.sufix under public directory.
See http://docs.meteor.com/#structuringyourapp
If you want otherPath to be within meteor app, public won't do.
There are several ways to do that, http://multi-page-config.meteor.com is one way to create what looks like a traditional multipage site within one meteor process.
I did this a while ago and have since perfected it a bit but haven't updated it.. this at least might give you some ideas... you can look at the source here: https://github.com/bolora/multi-page-config