Angular merge multiple JSON files into one - json

I am trying to configure the i18next framework for translations in my angular app. I would like to have multiple JSON files (one per view or part of application) e.g home, catalogue.
The way I want to approach this is I want to put all of these in the assets folder under translations so the structure will look like this.
-home.json
-catalogue.json
Then eventually when the build runs I want to bundle all of these into a single json file: for example en-GB.json.
The problem I am facing is I don't know how to go about this. I can't locate the webpack config and if I was to introduce one, what would be the impact?
In short how can I bundle multiple JSON files into one file.

Related

Extracting attribute values from Vue.js components during build and write to JSON

I want to create a process that extracts attributes from HTML tags in components and stores the values in a JSON file. The idea would be that I'd first add these attributes to my HTML within each Vue component as I write it e.g.
<p custom-attr="value"></p>
Then when I run the npm script to build, it should extract all these attribute values across all files and store within a JSON file local to the project.
I figured I could add a script to package.json scripts which runs when the app builds which is fine. For extracting the attributes, one thought would be to read each Vue file using nodes fs.readFile and then writing in the same way.
Would this be the best option? Is there a better way to do this? Thanks

Generating .html file from template engine

My aim is to create some html files (about 30, preferably via CLI) that are identical except for some arbitrary variables to be replaced in the url of links and scripts sources.
I wish I could automate the file creation process but I'm still struggling with the structure.
My first idea was to use Mustache or Handlebars and save the HTML output to file. It's possible with those tools? Are there any more suitable tools or methods?
Ideal for me would be to create files via node and CLI
Any suggestions are welcome.

How to export multiple STIX2 bundles?

I have been working on Threat Feed Recently, I am trying to export all the threats that I have found on my system as STIX2 format.
I have gone through the it's documentation and I have created the Stix2 bundles. Now I am trying to figure out the way to export all the bundles to one file so that this file can be used in threat feeds, For instance splunk is a tool that allows to read this stix feed.
A single bundle looks like this.
{"type":"bundle","id":"bundle--92bf6237-1b3d-43f9-85d7-e31c0b3f11b7","spec_version":"2.0","objects":[{"id":"indicator--c68d9454-32e3-4f30-8321-a6758df83877","type":"indicator","created":"2017-10-27T00:00:00.000Z","modified":"2017-10-27T00:00:00.000Z","name":"File hash for malware variant","pattern":"[file:hashes.md5 = 'a5ef29d5315111c80a5c1abad14c8972']","valid_from":"2017-10-27T00:00:00.000Z","labels":["malicious-activity"]},{"type":"malware","id":"malware--0e1f009a-0e6c-437e-a1ec-0c003522b1d3","created":"2017-10-27T00:00:00.000Z","modified":"2017-10-27T00:00:00.000Z","name":"Malware","labels":["remote-access-trojan"]},{"type":"relationship","id":"relationship--c17cf161-4ec2-471c-ac58-4a1cf6e0964f","created":"2017-10-27T00:00:00.000Z","modified":"2017-10-27T00:00:00.000Z","relationship_type":"indicates","source_ref":"indicator--c68d9454-32e3-4f30-8321-a6758df83877","target_ref":"malware--0e1f009a-0e6c-437e-a1ec-0c003522b1d3"}]}
Now I have multiple bundles how can I export them?
In a TAXII feed, it is one STIX2 bundle per content block. You can use OpenTAXII server (supports TAXII 1.1 and is content agnostic) to serve that feed to your Splunk instance.
If you read data from files, store every bundle in a separate JSON file.

Polymer build compress

I am generating a component application in Polymer .. as a template I used the following: https://github.com/PolymerLabs/start-polymer3. Everything works excellent, I uploaded it to firebase, the point is that I want to make 'polymer build' generate the structure of folders: build / s6-unbundled, along with other folders like node_modules and my custom script, if you know some way to compress all the scripts generated in the build into a single file. Since the components I want to insert in third-party sites but I want to load only one js file and not have to load all what the polymer generates. I've done this with vue-custom.component but I do not know how to Polymer. I appreciate your help.

How to store response of rails app to filesystem

I would like to generate a bunch of static pages with my rails app, which then will be stored to the filesystem in order to be part of a build step in a yeoman webapp.
The filetypes would be JSON and HMTL.
Therefore I would like to know what would be the best solution for this problem. Fetching the site with Nokogiri or something similar, transform it to string and put it into a file. Or maybe write a rake task, which starts curl which then puts it into a file.
Or is there something build-in which can handle this type of problem?
Update:
I guess I have to make my goal clearer: I would like to build a website generator, which can export webpages and json to the local file system. In order to get fast response times and to use my existing build process I would like to generate those files and not serve them via rails.
Not sure what you're trying to do, but you might consider something like middleman. It's meant to generate static files, but you can still do ruby/rails like magic, etc.
http://middlemanapp.com/