polymer build command output the result to the build directory.
Is there any way to change the output path?
/* Output directory example */
./build/
├── es5-bundled
├── es6-bundled
├── es6-unbundled
└── polymer.json
You can change the names of the subfolders within build folder to any name you like. Just change the name property in builds array of your polymer.json file.
See the documentation for this.
Currently, no method exists to change the build output path (see this issue). You can, however, use polymer-build (the same package used by polymer-cli) with gulp, which gives you a lot more control over those kind of things.
Related
I have Nuxt.js project whose contents are
alok#alok-HP-Laptop-14s-cr1xxx:~/tmp/portfolio$ tree -L 1
.
├── assets
├── components
├── layouts
├── middleware
├── node_modules
├── nuxt.config.js
├── package.json
├── package-lock.json
├── pages
├── plugins
├── README.md
├── static
└── store
9 directories, 4 files
This is very nice structure which is described on https://nuxtjs.org/guide/directory-structure .
I have some CSV data which I want to display in table in page/template. So how and where should I keep my this CSV data file so which can be easily accessed and rendered in template/page?
It really depends on your data, your setup and experience...
If your data is not changing too often and you are willing to build and deploy your app every time it changes, the simplest thing you can do is to convert csv to json and include myData from myData.json directly from JavaScript (and keep it in the same folder as your component)
data will by part of your app bundle (ok if its just few lines)
works great with static site (nuxt generate) or SPA mode of Nuxt (don't need Node on server side so it can be hosted on Netlify and such)
simple
Other option is to put in inside static folder but then you will need to download it into your running app at run-time using Ajax (Axios for example). You can find examples here
more complicated
ability to update data without building whole app (just upload single file)
Even in this second case I would argue its better to parse it once and convert into something JavaScript can read easily (like JSON) and keep it that way instead of parsing at run-time every time someone uses your site...
I'm creating an IOS app with swift and I'm having a lot of trouble and cannot seem to find the answer.
I have a giant (local) folder that contains a lot of JSONs in my app directory. The path tree looks like:
APP
├── _LocationJSONs
| └── (All 300+ JSONs here)
├── AppDelegate.swift
├── ViewController.swift
├── Main.storyboard
├── LaunchScreen.storyboard
└── Info.plist
I need to read in and parse all the JSONs from that local directory, however I don't always know the name.
I've seen Bundle.main.path(forResource: "file name", ofType: "json") but I can't use that becuase it requires a hard coded name. I've also seen doing something like
let fm = FileManager.default
let path = Bundle.main.resourcePath!
But that just leads to a documents path and I can't seem to get anything from there
Is there any way to 1. Get the path of that directory, and 2. Get the name of all the JSONs that way I can parse them later?
You should use the Bundle method urls(forResourcesWithExtension:subdirectory:localization:) and pass in subdirectory: "_LocationJSONs".
That will let you get a list of all the files inside your "_LocationJSONs" subdirectory that have a given extension (probably "json" in your case)
Bundle.main.urls(forResourcesWithExtension: "json", subdirectory: "LocationJSONs")!
(Might want to do better unwrapping but this works for now)
I have a YAML file that holds some data and needs to be processed client side.
---
some: content
...
Jekyll handles everything with Front Matter, which results in the whole YAML content to be treated as Front Matter and the page then has no content.
Is there a way to tell Jekyll to treat the file as static, even though it has a YAML header?
I tried different combinations of exclude and keep_files, also setting Front Matter defaults in my _config.yml, but nothing is really working.
My workaround now is to add an additional Front Matter block in front of the content:
---
layout: null
---
---
some: content
...
The YAML file though is a swagger definition and adding this extra block would both:
make it complicated to test/generate the definition locally or in Swagger Editor
Generate confusion, if the file is downloaded via github.
So ideally I would like to store the file without any modification and somehow teach Jekyll to leave it alone.
There is no way to tell Jekyll to avoid to process a file with front matter without a plugin.
A simple solution would be to use Jekyll hook's to copy the original unprocessed file with front matter to the generated site just after the whole site has been generated.
For example, adding _plugins/copyfile.rb:
Jekyll::Hooks.register :site, :post_write do |site|
src = "_unprocessed/about.md"
dest = "_site/assets"
puts "Copying #{src} to #{dest}"
FileUtils.cp(src, dest)
end
That would copy _unprocessed/about.md with front matter to the final site assets dir.
As _unprocessed starts with an underscore it won't be present in the resulting site.
Building the site:
/tmp/s⟫jekyll b
Configuration file: /tmp/s/_config.yml
Source: /tmp/s
Destination: /tmp/s/_site
Incremental build: disabled. Enable with --incremental
Generating...
Copying _unprocessed/about.md to _site/assets
done in 0.884 seconds.
Auto-regeneration: disabled. Use --watch to enable.
/tmp/s⟫ tree _site/
_site/
├── 404.html
├── assets
│ ├── about.md
│ └── main.css
├── feed.xml
├── index.html
└── jekyll
└── update
└── 2017
└── 11
└── 09
└── welcome-to-jekyll.html
6 directories, 6 files
Cross-posting my answer here as it may be relevant (not sure; I'm not a Jekyll user but github pages uses it.) https://stackoverflow.com/a/48954668/1461007
I am looking for a way to have multiple markdown files (.md) in a directory and have them available as files (not sub-directories).
Example:
├── about/
| └── index.md
| └── history.md
| └── vision.md
I want these to become urls like this (treated as files (no trailing slash))
base.url/about/
base.url/about/history
base.url/about/vision
instead of (directories (trailing slash)):
base.url/about/
base.url/about/history/
base.url/about/vision/
How can I achieve that?
You can do this with Jekyll 3.x using permalinks in your files front matter. But, if you want to use this with Jekyll 2.4+ and Github pages, it seems that there is a problem.
Permalinks with trailing slash are the way to go for now.
I have a DMD + Tango bundle on linux. Please give me the step by step information, how can I use an external library in D, for example zlib. I have compiled zlib.
I have a file tree like this:
myzlib
├── include
│ ├── zconf.h
│ └── zlib.h
└── lib
└── libz.a
I've got the import tango.io.compress.ZlibStream; call in my myfile.d source.
And these are my questions:
Do I need to copy these files to the dmd/lib directory?
Do I need to modify dmd/bin/dmd.conf file?
How should I call dmd compiler (dmd myfile.d -Llibz.a) or something else (maybe, with absolute paths)?
I've never tried to use external libraries in any other language. Please help me.
The -L flag tells the linker to add a particular directory to its search path.
-l tells it to link in a particular library, and it searches on its search path to find that library.
With DMD, you have to pass flags to the linker with the -L flag.
It can take either absolute or relative paths, but the paths need to be relative to where the compiler is run from. So if you use relative paths, then you always have to run the compiler from the same directory (which generally isn't a problem, since you'd typically have the build command in a Makefile which you always run from the same directory).
The most common thing is to use absolute paths for libraries installed on the system and relative paths for libraries specific to your project.
So, if you have the library myzlib/lib/libz.a, you would pass -L-Lmyzlib/lib -L-lz to dmd.
It would then add myzlib/lib to the linker's search path, and then look for libz.a in its search path (the linker knows to take the part following -l, add lib to the front of it and add .a suffix to the end to get the library that you're looking for).
You can add the linker flags to dmd.conf, but I really wouldn't advise it. The flags in dmd.conf are what dmd always uses for every program. So, you should really only have the flags there that are used in all of your programs.
Rather, feed them to dmd directly (be it on the command line or as part of a Makefile).
As for the header files, you're going to need to duplicate any of their declarations that you need in a .d file.
Header files are used by the C or C++ compiler, not the linker. D shares the same linker as you'd use for C or C++, but its compiler is dmd, not gcc.
So, you need to duplicate the C declarations in a D file. The simplest way to do that is with htod utility, but it only works in Windows or Wine.
Regardless, you'll need to declare the C declarations that you'd be using in a .d file and mark them with extern(C).
If you set up your build to do the compile and link steps separately (like it is common to do with c), it is essentially identical to doing the same with C. First, get your build working without the extra lib (to make sure you are passing all the needed flags to the linker) and then add the libs in as normal. To use a C library from D requires a bindings file, they are effectively just a D file consisting only of prototypes.