Brunch build tool: subfolders in the assets directory are not copied? - brunch

i'm trying to set up my first project using Brunch, and i'm having a small issue, i want brunch to copy all files and subfolders in assets/ to the public/ folder, but it only copies the files and ignores the subfolders and other files.
And another thing is that i might like to have a folder called styles with subfolders for images and fonts, and i want them to be copied to the same place but in the public/ folder, is that possible?
here is an example:
app/
-assets/ html files, some xml files and ico's too
-styles/
-scss/
-img/
-fonts/
-scripts/
-vendor/ js and css files.
target folder:
public/ all files from assets
-styles css from scss folder, and a css for vendor's css
-img
-fonts
-js vendor and app js files
Thanks ahead!

Brunch only handles assets inside assets folders by default. You can also create app/styles/assets subdirectory.
If you want to change this default behavior, it's possible to change config.conventions.assets.

Related

Ignore src and node modules in Google cloud build

I had deployed a React app to google cloud Build. Deployment is successful. But I have to hide the src and node modules directory.
Currentely Its showing
I have tried adding .gcloudignore with content
node_modules/
*~
Do you have any idea how i can hide my source files. After the build all complied code generates in the dist directory.
I am assuming that the folders node_modules and src are in the top-level directory to be uploaded, then the .gcloudignore file will look like:
#!include:.gitignore
/node_modules/
/src/
*~
The first line #!include:.gitignore allows .gitignore file, 2nd, 3rd and 4th line prevents uploading of node_modules, src directory and any files ending in ~.

Accessing uploaded files outside the dist folder Angular 2 +

I have a folder outside of the Dist directory called uploads. This is where all files uploaded are stored. Namely image files.
I can not figure out how to access these files without them being in the Assets directory in the dist folder. Putting them in the dist folder is not an option here.
If I upload them directly into the dist folder it will work in prod, until I need to take the site down for maintenance, then the whole dist folder will be destroyed on rebuild, and subsequently all the uploads.
If I upload to the assets folder in the src, they won't be displayed because they are not in dist. I am extremely confused and not sure what to do.
The outline of the project is to have uploads ran through a Node.js back end, stored in a local directory called uploads, and then accessed from the dist folder.

How to correctly setup folders / files in nodejs?

I am currently starting out in node.js and I am a bit confused with the folder/file setups. Let´s say I have a main folder where all my different projects are located, and those are folders too. Now where do I need to keep my node-modules folder? Also how about the package.json file, do I need that inside each project folder?
use npm init first
it will make a package.json file.
Install the dependencies which be stored in Node_modules folder
Now make a folder named Public
with subfolders assets, css, js, index.html -- the FrontEnd part

mdBootStrap and NodeJS Directory Structure Inquiry

I've read over the documentation and I cannot seem to find a clear answer as to the proper directory structure for a node application (insert downvotes here).
When I create an application directory off the root. All js, css, and img directories will be based of this application directory. My confusion comes in where when I install mdBootStrap using npm it creates the node_modules and mdbootstrap directory as expected, but then down these chains of directories it creates it's own js and css directory as well.
So back in the main application directory, in the HTML files, when I reference bootstrap and jquery files for example, am I forced to reference all the way down the node_modules directory, or has the mdBootStrap actually become my new application directory.
If you are using express you can expose your node_modules dependancy folder through your routing by adding a static route.
var application = express();
application.use('/mdbootstrap', express.static(__dirname + '/node_modules/mdbootstrap'));
Other options are using gulp build tasks to include the node_module dependancies in your output build.

Project structure for a src to dist folder using node_modules

I'm working on an project that makes use of npm's node_modules. In my case it's an Angular 2 project with Typescript, but I don't think that relevant.
My project structure looks like this:
/
dist/
main.js
index.html
node_modules/
** all node modules
src/
main.ts
index.html
The sources are in the src folder, and everything is automatically copied to the dist folder on save (Grunt tasks).
The only problem is, how do I reference the node_modules from the index.html file?
I could put a ../ in front of the path of every script that I reference in the index.html. But in a production environment the index.html will be in the root directory like the node_modules folder is. That means I have to update all the style and script references and remove the ../ infront of all paths.
I have the feeling there is a better way to setup my work environment. I couldn't find any pleasing examples.
How do other projects do this? Is there some sort of a uniform standard that seems to work well?

Resources