What are the ways to include new css file into magento 2 - magento2

Please help me I have created new custom theme in magento 2 but I am facing problem to add new css file into theme.
For your information I have deploy code using composer to pub folder. Css files are copying there but not including those to frontend.

Suggest you start here.
Add your CSS as part of a layout as discussed in this topic.
If you have other questions, please let us know.

Recently In magento2 I have included css file in catalog_product_view.xml as
<head>
<css src="mage/gallery/styles-view.css"/>
</head>

Related

Use local assets in SonarQube 6.3.1 custom plugin's web page

I would like to insert some pictures in my custom web page for SonarQube 6.3.1. I tried to put it in resources/static like javascript files and call it with <img src="image.png"></img>but it doesn't work.
I do not really understand how SonarQube manage custom pages within the static folder. I followed the official guide but I do not understand for example how to use external resources (images, html templates, etc.) in the js file of my page.
Thank you for your help,
Benoît
I have finally found how to use my assets:
Put your assets in src/main/ressources/static, for example I added an image here src/main/ressources/static/images/loading.gif
Let myplugin my plugin's identifier
I am able to use my gif in src/main/ressources/static/page.js like this <img src="../../static/myplugin/static/images/loader.gif"></img>
Maybe it can help somebody...

Magento 2 - How to add additional js files to product page only

Magento 2 use RequireJS and different approach than version 1. Therefore, if I want to keep using the default theme luna, to extend the product page by adding one javascript file. What is the best way to do?
Should I extend it by creating a new module?
--Update--
After thinking my question above, here, I'm listing what I would like to do in steps as follow. But need help to find the way and solution. Since I'm new to Magento 2, some questions might be too simple to you, please don't mind to give help. Thanks!
Create a child theme and use Luma theme as parent. (I'm studying http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/themes/theme-create.html but there are many questions in the detail on how to locate a js file)
Magento 2 use RequireJS. What is the best way to put my js file, such as, if I have a js file to trigger some events on product variation changes. And the js file named custom-events.js. Where should I put?
--Update--
Created a child theme of luna, ie: named as: Vendor and lunachild:
app/design/frontend/Vendor/lunachild/theme.xml
app/design/frontend/Vendor/lunachild/registration.php
app/design/frontend/Vendor/lunachild/etc/view.xml
How to place catalog_product_view.xml in my theme?
You can add your js throught xml layout. You have to override catalog_product_view.xml to local theme.
<?xml version="1.0"?>
<!-- /** * Copyright © 2015 Scommerce Mage. All rights reserved. * See COPYING.txt for license details. */ -->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<link src="Custom_Module::custom.js"/>
<css src="Custom_Module::custom.css"/>
</head>
<body/>
</page>
Also you can add css or js using require.js and using head.additional block
I found the better approach is to go through the detail of callback logic:
http://devdocs.magento.com/guides/v2.0/architecture/view/static-process.html
Besides, there is a great tutorial to explain how to init javascript in Magento2 : read this: http://alanstorm.com/magento_2_javascript_init_scripts, and also the Magento Doc: http://devdocs.magento.com/guides/v2.1/javascript-dev-guide/javascript/js_init.html

How to create a base template and use it to wrap other templates in Ionic framework?

I couldn't find anything about this. basically i want to create a base template, with all the head tag and container in body or menu, etc... so that other templates can extend it.
how would i achieve this with Ionic framework?
The way you have phrased your question leads one to think you have not quite understood how Ionic works...
A typical Ionic app has only one index.html file with a <head>. The rest of the .html files are just content templates to be rendered as the content of that page. So you don't need the "base template" you are asking about, that is all taken care of by Ionic, from the index.html.
I would suggest reading and following http://ionicframework.com/docs/guide/starting.html

Sails JS: What is template in layout.ejs?

I am using linker in Sails JS.
How to use ? And What is this?
Is this HTML Template or Javascript Template?
How can I use this?
I tried put a html file in my assets directory.
But I can't understand how to use .jst file.
Answered over here: How to serve a bootstrap template in sails 0.9?
Another good resource is Irl Nathan's excellent video tutorials

Weird line in <head> in Typo3

I just started a new Typo3 4.6 site and I found this weird line right off the bat in the
<link type="text/css" rel="stylesheet" href="data:text/css,">
Where does it come from? And how can I get rid of it?
This is the link to the css stylesheet which creates the styles for the pages in your Typo3 CMS. You probably need this line and might want to keep it.
It must have been added from some extension. I used the introductory package. Ive done a new site with the blank package and its not there anymore. Thanks!