Where do custom components go in Next.js 13 file structure? - next.js

With this version, are you meant to create a Components/ folder inside the app folder? Or can I add new components anywhere in the file structure?
I currently have a components/ folder nested inside the app/ which seems to work fine. But I'm not sure if this can cause issues or if there is a better approach.
Can each "page" get it's own components/ folder?

In NextJS anything you keep inside the pages folder is considered a page or subpage, lets's say you have created the components folder inside one of the pages folders like below. Then you can access the components inside this folder as pages, so you can access this component with the below URL.
https://baseUrl/admin/components/componentName
So in NextJs, everything we put inside the pages folder is considered an individual page. If you want a separate space/folder for components you can create feature-level components outside the page folder like below.
Now components added in this feature folder are not accessible as a page and you can reuse these components as you want.
I hope this answered your question. Happy coding!

Related

Shiny: Linking to my shared images and css files across apps

In Shiny, how can I link to an image or a css file that is not in the www folder of the app?
The situation is that I have several apps that share common code, but need to be treated as distinct apps. At the same time I want them to be styled similarly and therefore I want to link to images and css files that are not specific for the app.
The only way I know of linking to images and css files is to place them inside a folder called www in the app directory. But that means that each app will need a copy of the files, because each app has its own www folder.
When running an app I've noticed that Shiny itself links to files in a subfolder called shared/ but I have not yet found where that folder is located. Can I put my custom files there too?
Symlinking from the www folder to a common place comes to mind, but I'd rather not to have to do that. I'm also aware that I can include css styles inline in the html, but that's another thing I want to avoid.
After much searching I finally ran into addResourcePath.
It worked like a charm when added before the shinyApp call.

How to integrate wrapbootstrap theme into asp.net web site in visual studio 2013?

I am new to bootstrap. I downloaded a wrapbootstrap theme and is trying to include that in my website. In the downloaded theme, there are several folders under a folder called assets, like bootstrap, css, js, icons, img. Under bootstrap folder there are again subfolders called css, fonts and js. Can anyone please tell me where exactly in the project should i add these files? In case of a simple theme, I know we need to add the bootstrap css under Content folder and the bootstrap js under Scripts folder and we need to add it in BundleConfig.cs. But here, since there are different css files and js files, where can I include them?
Thanks in advance.
Where the files are located is really irrelevant so far as your application is concerned. The ~/Scripts and ~/Content folders are just a default convention that Visual Studio uses with the templates.
However, nothing is preventing you from moving them. When working with a template, you have one of two choices.
Leave the files as they are, and simply reference them, or include them into bundles in the paths they are located in.
Determine which CSS and JS files you need, and re-shuffle everything to suit your particular projects needs.
The first option makes it easier to upgrade the template in the future, while the second option makes your project files more coherent because they follow a similar structure.
At the end of the day though... it's all just a resource location for you web server to resolve. Do whatever makes sense for your project.

How to put a Template together with Ruby on Rails

I have a template, one of those you could buy, with many css/js/images, very beautiful.
But I have to control these pages with Ruby on Rails, which I am still learning.
The template files have many directives for other files and folders.
I am trying to understand the Assets Pipeline and I am feeling that it looks not good.
There are dozens of css files, with the directives for many images that are placed in other folders.
I am very scared to be straightforward.
I am not the project owner, I just have these two requirements:
Use this template
Build the system in Ruby on Rails
Could someone indicate me the correct way to get along with this situation.
Thanks a lot.
There is no direct solution to this, but may be this can help: install_theme gem. I haven't used it but the link shows how to use an html/css/js theme in rails application.
Friends,
There is a solution for dummies!
I am feeling so fool.
Inside Rails folders, there is a folder called public
We just have to put our css/js/images inside this folder.
For example, in my template, the index.html was in the same folder then a folder called assets which has sub folder css, js, images
So, the files need for index.html were (relatively to it) in assets/css/... or assets/js/...
Thus, all I had to do was copy my whole folder assets to inside the public directory below Ruby on Rails files.
I found it here:
The Asset Pipeline
I am sorry for the dummy question.
Thanks a lot!

Symfony2: how to refer to images in root resources in css

Apart from having css, js and images in bundles, I also have some in the App/Resources/public folder of my Symfony2 app.
Does anyone know how to refer to an image in the App/Resources/public/images folder, in a css-file that lives in the folder App/Resources/public/css ?
I am using Assetic, however these images transcend the level of bundles; they are "global" so to say (eg the company logo).
I've tried quit some combinations of urls, but the images are not found by Symfony2 and they are not dumped into the web folder.

asp.net static content in separate project. now how to refer?

Project1.csproj is the website project and StaticContent.csproj is the static content project to hold all .css, .js and image files. I am keeping it separate so that designers can work without touching the main project file and may be use cdn in future. But the problem is how do my .ascx and .aspx pages will refer to these css and js files as that when I run in localhost, it still picks up.
I think the best way is you create a website in IIS for the Static project, and reference it trough something like static.myproject.com (having the appropiate setup) on the other one.
You can still use Webdevserver on Project1.
Is most like what you will have when deploy, and you can put the URL on web.config for easy change

Resources