Sylius installation: When do you need to do yarn install? - php

According to the Getting Started guide https://docs.sylius.com/en/latest/getting-started-with-sylius/installation.html I need also to execute "yarn install", etc.
Do I really need this if I plan to use Sylius in Headless mode?
Thanks for help!

Yarn install is required for making the front end and admin panel look as you would expect, without running it all the content will render and the site will function as otherwise, however CSS and JS assets will not be served

Related

Some TailwindCSS classes in a fresh Laravel install is not working

Some TailwindCSS classes that involve color (namely bg and border) are not working.
This is my very first Laravel project and I am not sure where the problem is. Somebody else started the project and I cloned the git repository. I am developing locally on a Ubuntu 22.04 desktop box with Apache2 -v 2.4.54 and php -v 8.0.20. I got Laravel working weeks ago and spent all my time getting data on screen. Now I am trying to beautify my pages. I did not know that you had to install TailwindCSS seperately from Laravel so I installed it yesterday. I installed npm and TailwindCSS via npm install -D tailwindcss postcss autoprefixer. Tailwind.config.js, webpack.mix.js and /resources/css/app.css were already a part of my git repo and appear to normal.
Question: If you already have the needed files, is 'npx tailwindcss init` necessary (my init fails with a yaml error)?
I think TailwindCSS is working some, but I am not entirely sure. I added bg classes to the man Laravel and it seems to totally skip the class any bg and border classes I add.
I did have have the color-adjust warning when I ran npm run dev, but was able to get rid of it by targeting the a specific autoprefixer version.
autoprefixer: Replace color-adjust to print-color-adjust. The color-adjust shorthand is currently deprecated
I added the bg-blue-500 class several places, but nothing seems to work. There are other tw classes that appear to be working.
Question: What would cause these classes to be totally ignored? Did I miss something in the install?
Don't use the welcome page as an example. It contains all the tailwind styles it needs locally (in the head) on the page. Experiment with one of the internal pages.

How to cache composer packges in Jenkins

I've got a Laravel project and simple pipeline in Jenkins which build Docker image from Dockerfile, pull code in it and execute composer install. Everything working fine so far, but installing composer packages takes a lot of time (like 6-7 minutes). I've tried to persist vendor directory somewhere, create symlink to it or something but nothing worked so far. I wonder if there is some better more official way to handle that? Anyone has some idea or experience in it? Or maybe some different CI tool?
Ok, I ended up with two solutions:
I mounted composer cache directory to some directory in host to speed up composer packages installing:
dockerfile {
filename 'Dockerfile'
args '-v $HOME/composer_cache:/.composer/cache'
}
There is (not so obvious, because Jenkins panel is little messy) option to disable workspace clean up before/after code checkout. One can delete those steps in pipeline configuration under "Branch Sources" section (with red X above those "Behaviours").

How to copy vendor folder without having not found problem

I am using composer for my project and the entire project (even the vendor folder) is under git version control.
I know it may seem like a false action but I am in bandwidth deficit and I want to lower my bandwidth usage so I use this method to just copy the vendor folder.
When I push to to another repository and try to run php main.php from there It says that can not find the classes that I am using there.
I have managed to solve this problem by removing the whole vendor folder and re running composer i but it is not the behavior that I want. I want low bandwidth usage, I want to not wait for package installation.
I am using the same method for virtualenv of python apps and there is the same problem but that problem can be solved by just running virtualenv venv/ again so it corrects the new paths for the copied environment. How can I achieve the same behavior with composer? I dont see any info or command that can help me doing this.
Thanks in advance folks :)
Found the solution.
All you need to do is to remove one file and one folder:
rm -rf vendor/composer;
rm vendor/autoload.php;
Then run composer i and it will recreate the removed composer folder again and corrects the autoload files.
Have a nice day.

Integrate React Js with Drupal-8

Is their a way to integrate Drupal-8 and React js.
I mean frontend be React js and backed be of Drupal-8.
I have gone through:
http://www.anexusit.com/blog/how-to-add-reactjs-drupal-8-composer
I have followed all the steps and done but dont know how can I use it.
Can any one please suggest some clear steps to me ..
also followed:
https://www.reddit.com/r/reactjs/comments/564gdy/react_frontend_for_your_drupal_8_backend/
In need of some clear suggestions.
Thanks in advance.
Found this article, but didn't get time to try it as I am a bit busy on another thing. Hope this will help you.
https://medium.com/#Userium/headless-drupal-build-a-drupal-8-api-with-a-reactjs-front-end-e43bf0fb94db#.2qn0u2im4
I'm currently building a module for Drupal 8 using ReactJS. I recommend you to see this: https://github.com/blackwood/drupal-react_blocks that's for Drupal 7 and then to Drupal 8 try to understand this portuguese steps: http://www.drupalbrasil.com.br/drupal-8-e-reactjs
Before starting just install libraries module to Drupal 8 and then install rest web services so after that you can copy and paste code from above to start learning how the integration works.
Using drush to install libraries and rest web services module:
drush dl libraries
drush en -y libraries
drush dl rest
drush en -y rest
I recommend you to use PHP 7 because I'm currently having troubles installing rest module for PHP 5.6.
I highly recommend you try this module (found in this repository: https://github.com/dtraft/react_quickstart ). Its built with react and can run in Drupal 8.
Add this folder in sites/all/modules/ or you can also create a subdirectory for modules you make in sites/all/modules/custom/ .
And then follow the instructions found below the repository's link or the read.md file.
Clear your site's cache in your site's Admin/Configuration/Performance/ then click Clear all cache. Save the configuration.
Then go to, Extend menu of your site search for "Decoupled Drupal with React Quickstart". Install it.
Lastly, go to Structure/Block Layout menu and add a block any part of you site and then you can choose from all existing blocks. Choose Clock Face Block.
Refresh your sites home page and there you have it!
If you want to integrate react and use inside, you can simply create a react app anywhere and when you finished just do a
npm run build
once you finished just copy the js and css file generated inside build/static folder :(js/main.something.js and css/main.something.css) to your drupal module or theme and then just reference theme in module_or_theme.libraries.yml

How to Deploy a Cake PHP App

I wonder if someone can help me. I've been handed in a Cake PHP app that I need to 1) add minor changes 2) deploy. I've never really worked with Cake before and was wondering whether do I need to anything in order for it to work?
For instance, With a Node app, you need to install modules npm install. With a Rails app you'll likely need to install the gems bundle install.
Is there something similar with Cake? I've set the localhost server, but when I try to access the url I get all sort of errors. Some I've fixed (missing environment settings which I just override the Redis host and port). The latest one is:
{
"exception":{
"class":"MissingControllerException",
"code":404,
"message":"Controller class Controller could not be found.",
"file":"\/Library\/WebServer\/Documents\/php\/oompbe\/vendors\/cakephp\/lib\/Cake\/Routing\/Dispatcher.php",
"line":154,
"trace":[
"#0 \.../app\/webroot\/index.php(109): Dispatcher->dispatch(Object(CakeRequest), Object(CakeResponse))",
"#1 {main}"
]
}
}
PS: What's up with all the crazy \/\/?
PPS: Can I find out the version Cake I'm running?
CakePHP is just php. As most properly done php apps these days it comes with composer. I recommend you to read at least the basics of it's manual. Composer is an awesome tool.
git clone <repo>
cd <reponame>
composer install
If you start a new Cake application the official documentation tells you how to this as well:
composer create-project --prefer-dist cakephp/app [app_name]
If you want to automate things further composer provides you callback scripts. They'll allow you to automate tasks, basically trigger commands, after different actions. This is pretty useful to build assets after a composer update for example. I recommend you to not put lots of commands into that section but instead have dedicated script files you trigger by the callbacks.
Can I find out the version Cake I'm running?
If installed via composer it is usually in vendor/cakephp/cakephp/version.txt. Check the content of that file.

Categories