Laravel 5.2 Fresh Install on Homestead rev-manifest.json Error Not Found - homestead

I'm new to Homestead, but not Laravel. I went through the process of setting up my new install, and was able to see the homepage welcome message.
Then I tried to enable authentication for user logins by running:
php artisan make:auth
This has worked for me outside of Homestead, but in this environment that starts the web page throwing the following error:
public/build/rev-manifest.json): failed to open stream: No such file
or directory
I've looked inside public, and there is no build folder. Should I create it? If I should create the json file, what should I put inside? And, more importantly, why am I getting this error in general?
Help appreciate!

Run npm install then gulp, to build your assets.
Otherwise you have to go to your master layout and delete Elixir helper calls (credit):
<!-- <link href="{{ elixir('css/app.css') }}" rel="stylesheet"> -->
<!-- <script src="{{ elixir('js/app.js') }}"></script> -->

Related

How to use mix function in laravel

I'm writing a program using laravel. To manage css and js, I used versioning and call it with a function like this
<link rel="stylesheet" href="{{ mix('/css/app.css') }}">
The code above produces html output as follows
<link rel="stylesheet" href="/css/app.css?id=53a226b301fc510ddf79">
When I upload to hosting, why does the above code only produce html like this ?
<link rel="stylesheet" href="/css/app.css"> (the mix-manifest.json / id file not load)
this is my localhost
and this is on the hosting
Did you run npm run dev after deploy it on your hosting?
Make sure in your webpack.mix.js have .version() method.
I think in your localhost your laravel run in development mode. And in the hosting the laravel run with production mode. Check your .env file.

Symfony doesnt find css file

I've just done a fresh install of the latest Symfony version. Inside my templates folder I've created a new folder called website which contains a base.html.twig and a home.html.twig.
File structure: templates/website/base.html.twig
Inside my public directory I've created the following css/app.css. Now in my base I've done:
<link rel="stylesheet" href="{{ asset('css/app.css') }}" type="text/css">
Inside my stylesheet I'm just setting the body background colour to red so I know it works. For whatever reason it isn't loading my css. When I view source it appears as:
<link rel="stylesheet" href="/css/app.css" type="text/css">
and clicking the href I just get a Symfony 404. I cannot figure out why it isn't loading my static CSS file.
I don't want to use Symfony Encore as thats overcomplicating things for my project. I have also tried assets:install command and nothing installed or changed.
UPDATE:
I installed and done a basic setup with Symfony Encore in the hope I could at least get some CSS working. Still get the exact same issue.
If you want to use the asset funtion you have to install the component first with the following command:
composer require symfony/asset
That is really all there is to it if you do not wish to use webpack encore.
Optional: If you happen to use PHPStorm with the Symfony plugin, go to settings > symfony and change Web Directory from app to public for the new directory that Symfony 4 uses. This gives you all the autocomplete goodness and your references will work.
You should store your static files inside the assets directory at the root of your project. So just place the css-folder with the app.css-file in <root>/assets/css/app.css
Source: https://symfony.com/doc/current/best_practices/web-assets.html

replacing local css with CDN url in usemin

I am using grunt build to copy files from production to build. While working I am using local bootstrap css, however in build I need CDN url to be replaced for bootstrap.
<!--build:css http://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css-->
<link rel="stylesheet" href="assets/css/bootstrap.min.css" />
<!-- endbuild-->
First of all is this possible? Grunt build is giving error for http path while using usemin.
Thanks.
Got temporary solution to this.
My grunt build was perfect except http:// url for bootstrap. So i used --force (grunt build --force) command to build my project.
This gave me warning but build the project as per my requirements and CDN url for bootstrap.

Symfony2:css, images and assetic

I've put a css file in MyDirectoryBundle/Resources/public/css.
I then linked to it using:
<link href="{{ asset('css/main.css') }}" type="text/css" rel="stylesheet" />
I checked if it worked
short test: body {color: #FF0000;}
Nothing changed.
The parent layout (layout.twig.html) is in app/Resources/views (3 level architecture).
I still don't understand why:
css does not work
why the command: php console assets:install web/ --symlink fails
-> answer: The target directory web does not exist. (it does exist, actually).
I am quite new to symfony2 (2 weeks practice only).
I am working on Windows - just in case this may explain something...
Thank you very much for your help!
If the file first lived in MyDirectoryBundle/Resources/public/css, it'll be copied to web/bundles/mydirectory/css. So you have to include it like: {{ asset('bundles/mydirectory/css/main.css') }}.
You should execute the command from the root of your project. As you're using php console, it seems like you're in the app/ directory when executing this command. In that case, app/web/ does not exists, so the error is completely valid.
As you're on Windows, there is a change that symlink is not allowed/available. I believe it's available for admins only since Windows vista.
As a side tip, if MyDirectoryBundle is your app bundle (a bundle tied to your app and not meant to be reused by other apps), I would recommend to put the CSS file in the web/ directory directly. There is no need to put it in the bundle in such a case (this is only related to bundles that are shared, so the CSS is shared as well).
use php app/console instead of php console

Access to restricted URI denied when linking to LESS css

I just downloaded the semantic CSS and was running the examples but saw the following error on Firefox
Access to restricted URI denied
file:///C:/semanticcss/examples/fixed/fixed.less
Below is the code in the example page
<!-- Stylesheets -->
<link rel="stylesheet" href="fixed.less" type="text/less" media="screen" />
<!-- Scripts -->
<script src="../../js/less-1.1.3.min.js" type="text/javascript"></script>
How can I get rid of this error?
This is on purpose. Local files may only read other local files in the same directory or sub-directories.
See https://developer.mozilla.org/en/Same-origin_policy_for_file%3a_URIs
Try
[sudo] npm install less -g
Then it shouldn't have any problems with the directories. My system (MBP) did the same thing until I did this. The main problem was that it doesn't know where the LESS compiler is located. You will more than likely need root privileges to run the command, hence [sudo] is system dependent.
Hope this helps.

Resources