Public folder insinde ZF2 module and calling the assets - module

I have the following folder structure
- Admin (Module)
- config
- public
- css
- js
- img
- src
- Admin
- view
- admin
- layout
/admin.phtml
How can I use inside the admin.phtml the css and js files from the upper public directoy.
I know that this
$this->headLink()->appendStylesheet($basePath . '/css/bootstrap.min.css')
gets it from the root public folder and adding $basePath . 'module/Admin/public/css/bootstrap.min.css' isn't a solution because the module name can change.
Edit: also, the above solution isn't good because my module can be also in the vendor subfolder.

Related

Different image paths between dev and prod for vue require

I have the following architecture:
ProjectName
- dist
- img
- index.html
- src
- assets
- fonts
- img
- public
- img
I save static images in ProjectName/src/assets/img/
And save dynamic images (images that user uploaded) in public folder with path ProjectName/public/img from my Flask backend. I'm doing this because I want to get image on the fly without use webpack build
So, I can view images in developer mode use
return require('../../public/img/paintings/'+imgName)
But when I use production mode I must write without first ../
return require('../public/img/paintings/'+imgName)
Because dist folder has shorter path to public folder than non build project
How I come to agreement with different paths and don't change code before build?
I think I found solution for my problem.
I read answer https://stackoverflow.com/a/52083358/10683019 and understood that require using src folder and all works after changed return like in answer

Change default vuetify-loader variables scss file path

I created a project using Vue CLI (with typescript support), and added Vuetify with vue add vuetify
This create a file tree like this:
project
- public
- node_modules
- src
- components
- scss
variables.scss
- assets
main.ts
But, I want to change this structure to use something like Clean Architecture. So, I have
project
- public
- node_modules
- src
- application
- domain
- infrastructure
- web
- components
- assets
- scss
variables.scss
main.ts
But if I do this, vuetify-loader no longer loads my variables.scss file. Based on the documentation, it looks like it only loads the path src/scss/variables.scss
Is there a way to change the default path to src/web/scss/variables.scss?
vue-cli-plugin-vuetify appears to be hard-coded to expect that structure:
for (const ext of ['sass', 'scss']) {
const path = `${folder}/${file}.${ext}`
// If file doesn't exist in user
// project, continue to next
if (!fileExists(api, `src/${path}`)) continue
// If file exists, push it into
// the import statement
data.push(`#import '#/${path}${end}`)
}
Source
There is already an open issue in the repo to track for any change.

How to change path in the laravel config if It's located in the folder upper then public?

I have laravel 5 and config file in the config folder and My css located in the resources folder which is a same level with public folder where located index.php. Virtual Host Apache config looks to the public folder as a root site directory, but in this situation I cannot declare correct path from /public/index.php to the resources folder.
From one side I can try easy way and just relocate public folder into root of the laravel, but I don't like this way, any ideas?
Use resource_path('path/to/your/css')
https://laravel.com/docs/5.3/helpers#method-resource-path
EDIT
The most logical is to include your stylesheets in your public folder though. If you need to style a page, the style is public anyway. So why not put in the public folder. There's 2 options to do this:
Do it manually by just copying/moving the files
Use an automated tool like Gulp or Laravel's own Elixir, which provides a really easy way to copy your assets.
add this code in public/index.php
$app->bind('path.public', function() {
return __DIR__;
});

Adding Bootstrap code completion to Intellij project

All,
Using Intellij IDEA Ultimate 14.1.4. and trying to add Bootstrap 3 code completion to my project. I've downloaded the Bootstrap 3 plugin.
My project structure looks like this ...
MyProject
- app
- views
index.html
- public
- css
- bootstrap.min.css
- ...
- server.js
When I try to type in a bootstrap class in index.html such as class="col-sm-2", code completion does not work.
However, if I were to move my public\css folder directly under my project folder like so:
MyProject
- app
- css
- bootstrap.min.css
- ...
Now code completion for Bootstrap works when typing in index.html. What gives?
It seems it may be the location of the html page that's causing the problem. I put an html file in both app/views/ and public/. The public directory's html file received code completion, while the app/views directory did not.

How to load css in public files

On my project i have following routes (routes.rb)
resources :main, path: '/' do
collection do
get 'about'
get 'blog'
get 'resources'
get 'contact'
get 'projects-and-tutorials'
end
end
and these routes are loading files from public folder like about.html and contact.html, right now no css file is loaded on these pages.
I have created a css folder under public folder and will load css file from there on these public pages but i am not sure if it is good to go with
how can i load css files from app/assets/stylesheets or there is another way to load css on public files ?
You cannot load the files app/assets/stylesheets(not visible publicly) inside the files in public directory.
You can create a separate directory inside public folder and put your css files there. and then you can refer them directly.