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.
Related
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
I am trying to learn a bit about web technologies therefore I am trying to create a catalogue for my files.
The situation is the following:
I have a folder with N sub folders;
in each of there sub folders there is an image with always the same name (ie: image.jpg)
in each of there sub folders there is also a certain swg file with always the same name (ie: test.swg)
I would like to create an HTML file which read all the sub folders and create a preview using image.jpg, and when one clicks on the preview test.swg should be launched (not in the browser if possible)
The HTML files should contains all these preview like a catalogue.
How can I do this? should I have a local web server which runs in my machine? is it possible to do this with non web page technologies?
Thank you!
As far as i know Javascript & HTML doesn't have access to the filesystem as it's running on your browser and shouldn't be possible to go through the files iteratively because it would be some kind of breach in security.
If you ask me it's possible or not without a server, it should be possible but it is going to use other technology, for example:
Using a Command Line Interface in Linux or Windows based os you could write a shell script that iteratively will go through the files and folder path, and possibly create a JSON from it. From there the javascript could technically load that file like below.
<script type="text/javascript" src="data.json"></script>
<script type="text/javascript" src="javascript.js"></script>
But do note that you should periodically run the shell script periodically with something like scheduler or refresh it manually.
If you want to do it the normal way you could use many different server side language, for example NodeJs, or PHP as I think both of them require only little configuration.
You could post follow up question if you've decided on which language you want to use.
Below is some reference that you can use to start working on reading the directories
NodeJS
Node.js fs.readdir recursive directory search
Get all files recursively in directories NodejS
PHP
List all the files and folders in a Directory with PHP recursive function
How to recursively iterate through files in PHP?
After reading the directories & Files you just need to pass the data to the "rendering" part, and use some javascript to invoke the .swg when the image is clicked
But I'm not really sure about the .swg file can be invoked to the desktop app directly or not you could do some research on it
Open online file with desktop applications?
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.
I would like to use the parallel coordinate toolkit from syntagmatic.github.io/parallel-coordinates/#.
As I am new to the D3.js framework, I am encountering some trouble to begin and visualize data locally.
What I am trying to achieve is to use one of the standalone HTML examples (e.g. brushing.html) and edit the data table with my own data.
I stored locally (in a Windows folder):
the brushing.html example file
the cars.csv file
the D3.js library files from d3js.org (d3.min.js and d3.js)
When I load the HTML file in my browser, only the text displays, not the parallel coordinates themselves.
What am I missing/doing wrong? Should I be able to display locally the same result as what appears in brushing.html?
I checked out several tutorials for D3.js, but they generaly skip these preliminary requirements step. Thanks for any feedback.
Thanks to the straightforward comment to my question, I was able to identify the issues checking the browser's console.
It mainly came down to redefining paths to the different files, and eventually downloading the missing packages from the corresponding Github page https://github.com/syntagmatic/parallel-coordinates
I can now test the tool locally with custom data.
My workplace has a whole bunch of unannotated .zip files that need to be uploaded to the new file server (Windows). I've used perl to parse through through the excel files within the .zip files to create an annotation.txt file for each .zip file that contains information about the .zip file. I have 1000's of zip files and do not want to manually enter in information for each entry if there's a way to automate it. I am proficient in perl and mysql, and wondering if there is any way to utilize my skillsets to port this information into the Microsoft Sharepoint website.
Thank you in advance for any advice or suggestions.
There a many, many ways to meet your requirement.
You could write a event receiver to parse the files once uploaded and set metadata.
A better approach for your use case might be to write a .NET based console application and reference Microsoft.SharePoint.Client and then upload your files using the Client side object model (CSOM) and set the metadata during that process as outlined here: Upload a document to a SharePoint list from Client Side Object Model
There are also REST and ASMX webservices that you could call from a non .NET runtime process.
Plenty of options, pick the one that fits your needs and skills best.