including foundation using composer - zurb-foundation

I try to learn composer, now I want to include (zurb) foundation, so I added
"require": {"zurb/foundation": "v5.2.2"} to the composer.json file.
After running composer.phar update, I can see that there are some files added to the folder /vendor/zurb/foundation.
But I have no clue how to continue, could anybody please advise how I can start building my web-app now? How do I get it to use the css and js files that are needed for foundation?
I already included the file vendor/autoload.php to my index.php, but that doesn't seem to be enough.
I already built multiple web-sites and apps using foundation, but always "manual", then I just include the right css and js files to the header and footer of the page. Now I just don't know where to start.
thanks for your help.

Check this question first to get the basics: NPM/Bower/Composer - differences?.
Then, if you decide to go with Composer for PHP and Bower for front-end libraries, follow this:
Install Bower using sh $ npm install -g bower (you'll need Node.js and npm first)
Configure Bower for you front-end packages (visit Bower docs for more information)
{
"name": "MyProject",
"dependencies": {
"foundation": "*"
}
}
Hook Bower to Composer adding this to your composer.json
"scripts": {
"post-install-cmd": [
"bower install"
],
"post-update-cmd": [
"bower install"
],
}
Now every time you hit composer update (or install), bower components get updated as well!

Related

Blank page after deploying to github pages

Here are the steps I did to deploy to github pages:
Install the gh-pages package as a "dev-dependency" of the app
npm install gh-pages --save-dev
Add homepage property "homepage":
"http://{username}.github.io/{repo-name}"
Deploy script
"scripts": {
//...
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
}
npm run deploy
Setup source to the gh-pages branch.
I go to the link and find a blank page with an empty console. I've looked around and everyone suggests these 4 steps, and nothing seems to work.
I use npx create-react-app to setup my React application.
Here is the link to my repository: https://github.com/yuivae/yuivae
Please let me know if you have any suggestions
2 minutes I posted this thread I found the answer. I needed to change the react-router-dom path setting from
<Route exact path="/" component={Home} />
to
<Route exact path="/{app-name}" component={Home} />
because when deploying to gh pages by default I change / homepage path to the http://{username}.github.io/{repo-name}
After making this change I pushed, commited and deployed again and 10 seconds later it worked.

How to install drupal 8.5.0 using composer?

I am trying to install Drupal 8.5.0 via composer, using drupal-composer/drupal-project.
My OS is windows and I have run the command on "Command Prompt"
composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction
After run this command I got drupal 8.7.4.
But I want to install drupal 8.5.0 via composer for some demo purpose.
Please suggest me. Thanks!
The command you tried to run will download the latest dev version of the project. If you want to modify versions, or anything that comes along with the project, you can do so by adding the --no-install flag to your command:
composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction --no-install
This will download the files, but won't run composer install. Now you can edit the composer.json file to change the desired version of the drupal/core package.
But sadly whis will make conflicts with the webflo/drupal-core-require-dev package which only accepts higher core version than 8.7.0 - so you need to change that line as well to the desired version.
So, the require and require-dev section of the composer.json looks like this:
"require": {
"php": ">=5.6",
"composer/installers": "^1.2",
"cweagans/composer-patches": "^1.6.5",
"drupal-composer/drupal-scaffold": "^2.5",
"drupal/console": "^1.0.2",
"drupal/core": "8.5.0",
"drush/drush": "^9.0.0",
"vlucas/phpdotenv": "^2.4",
"webflo/drupal-finder": "^1.0.0",
"webmozart/path-util": "^2.3",
"zaporylie/composer-drupal-optimizations": "^1.0"
},
"require-dev": {
"webflo/drupal-core-require-dev": "8.5.0"
},
After changing the lines, all you need to do is run the command:
composer install
Also check out this thread on drupal.org

How can I speed up my first few pages on a ddev Drupal 8 project?

Drupal 8 is notoriously slow on the first page (like the install page) or the front page after a webserver starts up (including under ddev). Is there a way I can speed it up a bit? I think the problem is that all those thousands of Drupal php files have to be loaded into the opcache before it runs right. Is there a way to do that?
I'm experimenting with the brand new Composer-Preload package for this. It's fairly easy to get going with Drupal 8. The maintainer has been super responsive in improving it for compatibility with Drupal.
As suggested in the README:
composer require ayesh/composer-preload (or ddev composer require ayesh/composer-preload
Edit the composer.json to add the required section to "extra":
"preload": {
"paths": [
"web"
],
"exclude": [
"web/core/tests",
"web/core/lib/Drupal/Component/Assertion",
"web/core/modules/simpletest",
"web/core/modules/editor/src/Tests"
],
"no-status-check": false
}
run composer preload (or ddev composer preload). This creates the vendor/preload.php that does the actual preloading. It rummages through all the files in the listed directories to see what should be preloaded.
Link the preload.php into your docroot (or another directory reachable from the webserver). For example, is the docroot is "web", inside the web container (ddev ssh) do ln -s /var/www/html/vendor/preload.php /var/www/html/web/preload.php
If for ddev, add a curl command to run on ddev start in your .ddev/config.yaml:
hooks:
post-start:
- exec: curl -s localhost/preload.php
Your mileage may vary, but it seemed to me that my D8 project was much snappier to start with this setup. Thanks to #ayesh for the excellent Composer-Preload project, it has a great future.
Our solution has been to use APCu, which I recommend in production as well. Here's how we have DDEV setup -- also, I recommend disabling the Symfony APCClassLoader as it's deprecated and slower.
ddev/config.yaml
hooks:
post-start:
- exec: sudo apt-get update
- exec: sudo apt-get install -y php-apcu
your settings.php
// Don't use Symfony's APCLoader. Composer's APCu loader has better performance.
$settings['class_loader_auto_detect'] = FALSE;

cannot find module "child_process" in ionic 2

I am getting this type of error in runtime in ionic 2 project.
I want data from back4app serve.
I'm afraid the problem is that the module that you're trying to use might not be installed for you. From what I know, Back4App users can install their own modules by uploading a simple "package.json" file to their cloud folder. It needs to contain something similar to this:
{
"dependencies": {
"module_name": "module_version"
}
}
Also, if your module resides at Github then you'll just need to add a "git+" followed by the repository URL. The server will handle the installation and you'll be able to use the module properly.
If you have problems uploading the package.json you may always contact Back4App's Support Chat.

Update Foundation For Email 2 to v2.1?

How do I update an existing Foundation For Email 2 project to v2.1?
In the article about this new version nothing's mentioned about how to actually update an existing project.
Edit your package.json file to
“author”: “ZURB foundation#zurb.com”,
“license”: “MIT”,
“dependencies”: {
“foundation-emails”: “2.1.0”
},
Afterwards in terminal cd into your project folder and run: npm update.