Menu

Sviluppo Posts

Come cambiare il public path in Laravel Mix

Cosa ho imparato oggi: come cambiare il public path in Laravel Mix.

let mix = require('laravel-mix');

mix.setPublicPath(path.normalize('../public_html'));

mix.js('resources/assets/js/app.js', '../public_html/js')
   .sass('resources/assets/sass/app.scss', '../public_html/css');

Continua

Come avviare un comando DOS in background

Cosa ho imparato oggi: come avviare un comando DOS in background.

Questo è lo script batch che uso in ambiente di sviluppo per:

  • “servire” una applicazione Laravel
  • avviare il browser
  • attivare la compilazione in background degli asset frontend
  • eseguire la coda per processare i task
@ECHO OFF
start /b php artisan serve 
start http://127.0.0.1:8000
start /b npm run watch
start /b php artisan queue:work

Il parametro /b del comando start evita la creazione di una nuova finestra così ho il desktop più ordinato e tutti i messaggi che mi interessano in un’unico luogo :)

Continua

Come risolvere gli errori di NPM

Cosa ho imparato oggi: come risolvere gli errori di NPM.

rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install

Fonte: https://github.com/JeffreyWay/laravel-mix/issues/1072#issuecomment-319401164

Continua

Modificatori di path nei comandi BATCH del DOS.

Cosa ho imparato oggi: come utilizzare i modificatori di path nei comandi BATCH del DOS.

Variable with modifier  Description

%~I                     Expands %I which removes any surrounding 
                        quotation marks ("").
%~fI                    Expands %I to a fully qualified path name.
%~dI                    Expands %I to a drive letter only.
%~pI                    Expands %I to a path only.
%~nI                    Expands %I to a file name only.
%~xI                    Expands %I to a file extension only.
%~sI                    Expands path to contain short names only.
%~aI                    Expands %I to the file attributes of file.
%~tI                    Expands %I to the date and time of file.
%~zI                    Expands %I to the size of file.
%~$PATH:I               Searches the directories listed in the PATH environment 
                        variable and expands %I to the fully qualified name of 
                        the first one found. If the environment variable name is 
                        not defined or the file is not found by the search,
                        this modifier expands to the empty string.  

Fonte: https://stackoverflow.com/a/3215539

Continua

Come modificare il public_path di Laravel

Cosa ho imparato oggi: come effettuare l’override del public_path di Laravel in modo elegante e pulito. All’interno di AppServiceProvier::boot() va inserita la seguente chiamata:

app()->instance('path.public', realpath(app()->basePath('../public_html')));

Ovviamente il percorso ../public_html va sostituito con il proprio path.

Continua