ishanvyas22 / asset-mix Goto Github PK
View Code? Open in Web Editor NEWProvides helpers functions for CakePHP to use Laravel Mix.
License: MIT License
Provides helpers functions for CakePHP to use Laravel Mix.
License: MIT License
Hi,
in my project I've got several apps which are loaded into normal pages
ie: Pages/map.php -> will load map.js
Is there a way to compile different apps instead of only app.js
Thanks
Massimo
Describe the bug
I'm using cakephp-inertiajs
:
bin/cake asset_mix generate inertia-react
Output:
Error: "inertia-react" is not a valid value for preset. Please use one of "bootstrap, vue, react, inertia-vue"
To Reproduce
Steps to reproduce the behavior:
cakephp-inertiajs
)bin/cake asset_mix generate inertia-react
Expected behavior
Scaffolded inertia-react
app in assets directory.
Not sure if this is related to cakephp-inertiajs
(asset-mix not upgraded maybe), I didn't make a check yet.
Hi,
is there a way to pass my configuration variables from PHP to JS?
For example: application logo, email, url, etc
Where should we store SPA configurations? (Like in .env files)
Thanks
Massimo
My assets are hosted on a CDN in production. According to the Cake Book the App.cssBaseUrl
and App.jsBaseUrl
should be the URL and path to the CDN. When I set App.jsBaseUrl
to https://example.com/js/
I get the following error when trying to execute $this->AssetMix->script('app');
:
Unable to locate AssetMix file: /https://example.com/js/app.js.
App
array if one already exists.
'App' => [
'cssBaseUrl' => 'https://example.com/css/',`
'jsBaseUrl' => 'https://example.com/js/',
]
mix.js('resources/js/app.js', 'webroot/js')
.sass('resources/sass/main.scss', 'webroot/css');
$this->AssetMix->js('app');
to a template file.The CSS file should load from https://example.com/css/main.css and the javascript should load from https://example.com/js/app.js.
I wrote these tests in case they would be useful.
/**
* Test `css()` function returns proper url
*
* @return void
*/
public function testStyleTagWithExternalBaseUrl()
{
Configure::write('App.cssBaseUrl', 'https://example.com/css/');
$this->_copyWithoutVersion();
$result = $this->AssetMix->css('main');
$this->assertStringContainsString('https://example.com/css/main.css', $result);
}
/**
* Test `script()` function returns proper url
*
* @return void
*/
public function testScriptTagWithExternalBaseUrl()
{
Configure::write('App.jsBaseUrl', 'https://example.com/js/');
$this->_copyWithoutVersion();
$result = $this->AssetMix->script('app');
$this->assertStringContainsString('https://example.com/js/app.js', $result);
}
Is your feature request related to a problem? Please describe.
Yes, a problem I had while setting up this library on a Cake3 application. With asset timestamping (Asset.timestamp => true or 'force'
in app.php) enabled, AssetMix will fail to find the manifest. This is because Cake appends a timestamp to the end of the asset URL which means the "path" is not found in the mix manifest.
I'm new to this plugin and to mix/manifests in general, so I apologize if my terminology is inaccurate.
Describe the solution you'd like
Either update the docs to indicate that this setting should be turned off OR find a way for the manifest loader to ignore the timestamp in the query string when loading the asset file.
Describe alternatives you've considered
N/A
Add CHANGLOG.md file to keep track of changes happened in the package.
Existing node package dependencies require updatating due to found vulnerabilites when running npm install.
As describe in issue #30 (comment), it seems like there's security vulnerabilities in current packages versions which causes Laravel Mix version to bump up to 6.x.
To prevent this issue from happening it would be wise to upgrade the Laravel Mix version along with other dependencies.
Since there is no special bootstrap 4 functionality present (as far as I have seen) in this plugin I would guess it wouldn't be a problem to update the default generated package.json and stubs to use bootstrap 5 instead of 4.
Describe the bug
Hi, i'm new with react and laravel mix.
I'm trying to create an app when I get two deprecation warnings:
Router::plugin()
is deprecated, use the non-static method RouterBuilder::plugin()
instead. - /Applications/MAMP/htdocs/cakereact/vendor/ishanvyas22/asset-mix/config/routes.php, line: 11
You can disable all deprecation warnings by setting Error.errorLevel
to E_ALL & ~E_USER_DEPRECATED
, or add vendor/ishanvyas22/asset-mix/config/routes.php
to Error.ignoredDeprecationPaths
in your config/app.php
to mute deprecations from only this file. [CORE/src/Core/functions.php, line 322]
Router::scope()
is deprecated, use the non-static method RouterBuilder::scope()
instead. - /Applications/MAMP/htdocs/cakereact/vendor/cakephp/cakephp/src/Routing/Router.php, line: 912
You can disable all deprecation warnings by setting Error.errorLevel
to E_ALL & ~E_USER_DEPRECATED
, or add vendor/cakephp/cakephp/src/Routing/Router.php
to Error.ignoredDeprecationPaths
in your config/app.php
to mute deprecations from only this file. [CORE/src/Core/functions.php, line 322]
Is your feature request related to a problem? Please describe.
I'm using Tailwind to build the Cake App UI and would like to use Tailwind together with Vue.js
Describe the solution you'd like
As i know Laravel-Mix has an Tailwind Plugin and i think this could be used within your Plugin
Describe alternatives you've considered
If an integration is not possible i have to use Laravel-Mix directly
Additional context
no additional context here
Provide scaffoldings for Bootstrap / Vue / React, same as laravel does.
Any suggestions?
โ cake4 bin/cake plugin load -b AssetMix
Error: Unknown short option `b`.
For custom directories (other than assets
), webpack.mix.js
file's content generates invalid result on npm run dev
command.
Current webpack.mix.js
file content:
const mix = require('laravel-mix');
mix.setPublicPath('./webroot')
.js('assets/js/app.js', 'webroot/js')
.sass('assets/sass/app.sass', 'webroot/css')
.version();
It should be:
const mix = require('laravel-mix');
mix.setPublicPath('./webroot')
.js('resources/js/app.js', 'webroot/js')
.sass('resources/sass/app.sass', 'webroot/css')
.version();
Or whatever user has entered while generating custom directories
Develop new generate
command to create below file/folders:
webpack.mix.js
fileassets
directorypackage.json
Also provide options to take name from user for assets
directory, for example below command should generate assets
folder:
bin/cake asset_mix generate --dir=resources
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.