I would like to remove the glow, a.k.a outline, of the PrimeNG checkbox component. (I know, I know. It's for accessability and all, but I'm implementing this indicator myself)
I've tried to set every thinkable class or selector to outline: none, and even the big bang approach with
*:focus {
outline: none !important;
}
But nothing seems to work...
What do I need to do to get rid of it?
Thanks!
Edit, My angular-cli.json:
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"project": {
"name": "test"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.sass",
"../node_modules/font-awesome/css/font-awesome.min.css",
"../node_modules/primeng/resources/primeng.min.css"
],
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "sass",
"class": {
"spec": false
},
"component": {}
}
}
And at the top of my styles.sass I import my primeng.scss file:
#import 'primeng'
In the omege theme.scss line 242 you will see:
.ui-chkbox-box.ui-state-focus,
.ui-radiobutton-box.ui-state-focus {
-moz-box-shadow: 0px 0px 5px #1f89ce;
-webkit-box-shadow: 0px 0px 5px #1f89ce;
box-shadow: 0px 0px 5px #1f89ce;
}
This is the style giving the checkbox the glow. You can set those properties to none to stop this.
.ui-chkbox-box.ui-state-focus,
.ui-radiobutton-box.ui-state-focus {
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
If you don't want to edit the theme file you can override the css by doing something like:
.ui-chkbox-box.ui-state-focus {
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
}
The example above also includes radio buttons. Just reformat the css to exclude it: .ui-radiobutton-box.ui-state-focus
This is what worked for me
:host ::ng-deep .p-checkbox:not(.p-checkbox-disabled) .p-checkbox-box.p-focus {
box-shadow: none;
}
Related
I can't get Tailwind to work and I think it's because my configuration file is wrong?
/** #type {import('tailwindcss').Config} */
module.exports = {
content: ["./public/index.html", "./src/**/*.{vue,js,ts,jsx,tsx}"],
theme: {
extend: {},
},
plugins: [],
};
I installed Tailwind and used init:
https://imgur.com/nGWspSt
I filled in the "tailwind.config.js" like this:
tailwind.config.js
/** #type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/components/DropdownVue/DropdownVue.vue"], <---INCLUDED DROPDOWN FILE
theme: {
extend: {},
},
plugins: [],
};
I created an "index.css" and imported the Tailwind modules in it like this:
src/index.css
#tailwind base;
#tailwind components; <-----INCLUDED IMPORTS
#tailwind utilities;
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Noto Serif", serif, Ariel, Helvetica, sans-serif;
background: #d7d7d7;
}
img {
width: 100%;
object-fit: contain;
}
#import url("https://fonts.googleapis.com/css2?family=Noto+Serif&display=swap");
I started the build process and got an "output.css" file
https://i.imgur.com/mOKDwuc.png
that I included in my "index.html" file like this:
public/index.html
<link href="/dist/output.css" rel="stylesheet">
At this point it should have been working but it wasn't. I realized my config file was wrong so I changed it to:
/** #type {import('tailwindcss').Config} */
module.exports = {
content: ["./public/index.html", "./src/**/*.{vue,js,ts,jsx,tsx}"],
theme: {
extend: {},
},
plugins: [],
};
but it's still not working. Do I have to run the build process again because I changed the config file?
What am I doing wrong?
EDIT:
package.json
{
"name": "stripe-payment-vue3",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"#fortawesome/fontawesome-svg-core": "^6.2.1",
"#fortawesome/free-brands-svg-icons": "^6.2.1",
"#fortawesome/free-regular-svg-icons": "^6.2.1",
"#fortawesome/free-solid-svg-icons": "^6.2.1",
"#fortawesome/vue-fontawesome": "^3.0.2",
"#headlessui/vue": "^1.7.9",
"#heroicons/vue": "^2.0.14",
"core-js": "^3.8.3",
"vue": "^3.2.13",
"vue-router": "^4.1.6",
"vuex": "^4.0.2"
},
"devDependencies": {
"#babel/core": "^7.12.16",
"#babel/eslint-parser": "^7.12.16",
"#vue/cli-plugin-babel": "~5.0.0",
"#vue/cli-plugin-eslint": "~5.0.0",
"#vue/cli-service": "~5.0.0",
"autoprefixer": "^10.4.13",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"postcss": "^8.4.21",
"tailwindcss": "^3.2.4"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "#babel/eslint-parser"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead",
"not ie 11"
]
}
I am using both the sass parser and gruntpostcss with cssnano on watch. cssnano` is parsing the file just fine if its a short file, but it my scss/css file gets long css file, the it is not parsing the file. Anyone knows why that is and how to fix it?
Here the package.json, Gruntfile.js and both a short-css-file.css which works and a long-css-file.css where the cssnano is not parsing it.
package.json
{
"name": "testpage",
"version": "1.0.0",
"description": "testpage grunt",
"main": "Gruntfile.js",
"dependencies": {},
"devDependencies": {
"cssnano": "^3.10.0",
"grunt": "^1.0.3",
"grunt-contrib-watch": "^1.0.0",
"grunt-postcss": "^0.8.0",
"load-grunt-tasks": "^3.5.2"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Gruntfile.js
module.exports = function(grunt) {
grunt.initConfig({
watch: {
css: {
files: 'wp-content/themes/mytheme/assets/css/*.scss',
tasks: ['sass', 'postcss']
},
},
sass: {
options: {
sourceMap: true
},
dist: {
files: {
'wp-content/themes/mytheme/assets/css/default.css': 'wp-content/themes/mytheme/assets/css/default.scss'
}
}
},
postcss: {
options: {
map: {
inline: false, // save all sourcemaps as separate files...
sourcesContent: true,
},
processors: [
require('autoprefixer')({browsers: ['last 2 versions', 'ie 8', 'ie 9']}), // add vendor prefixes
require('cssnano')({zindex: false}) // minify the result
]
},
dist: {
files: {
'wp-content/themes/mytheme/assets/css/default.css': 'wp-content/themes/mytheme/assets/css/default.css'
}
}
},
});
require('load-grunt-tasks')(grunt);
grunt.registerTask('default', ['watch', 'sass', 'postcss']);
};
short-css-file.css
// Test
.css_nano, .css_nano + p, [class*="css_nano"], .css_nano {
/* cssnano will remove this comment */
display: flex;
font-weight: normal;
margin-top: 1rem;
margin-bottom: 2rem;
margin-left: 1.5rem;
margin-right: 2.5rem;
font-weight: normal;
padding: 1.75rem;
width: calc(50rem - (2 * 1.75rem));
}
long-css-file.css see in the jsfiddle
https://jsfiddle.net/12p3Lxcn/
I upgraded my app to angular 9.
I added #angular/fire to deploy in Firebase.
Everything works fine, ng serve, ng build, but when I use ng deploy to deploy the app in firebase, I get this message:
Error when trying to deploy:
Configuration 'production' is not set in the workspace.
Here is my angular.json
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"gadaproductions": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "app",
"schematics": {
"#schematics/angular:component": {
"styleext": "scss"
}
},
"architect": {
"build": {
"builder": "#angular-devkit/build-angular:browser",
"production": {
"buildOptimizer": false
},
"deploy": {
"builder": "#angular/fire:deploy",
"options": {"ssr":true}
},
"options": {
"outputPath": "dist/browser",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap.css",
"src/styles.scss",
"node_modules/primeicons/primeicons.css",
"node_modules/primeng/resources/themes/nova-light/theme.css",
"node_modules/primeng/resources/primeng.min.css",
"node_modules/quill/dist/quill.core.css",
"node_modules/quill/dist/quill.snow.css"
],
"scripts": [
"node_modules/quill/dist/quill.js",
"node_modules/jquery/dist/jquery.slim.js",
"node_modules/popper.js/dist/umd/popper.js",
"node_modules/bootstrap/dist/js/bootstrap.js"
]
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "5mb"
}
]
}
}
},
"serve": {
"builder": "#angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "gadaproductions:build"
},
"configurations": {
"production": {
"browserTarget": "gadaproductions:build:production"
}
}
},
"extract-i18n": {
"builder": "#angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "gadaproductions:build"
}
},
"test": {
"builder": "#angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.js",
"styles": [
"src/styles.scss",
"node_modules/bootstrap/dist/css/bootstrap.css"
],
"scripts": [
"node_modules/jquery/dist/jquery.slim.js",
"node_modules/popper.js/dist/umd/popper.js",
"node_modules/bootstrap/dist/js/bootstrap.js"
],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
},
"server": {
"builder": "#angular-devkit/build-angular:server",
"options": {
"outputPath": "dist/server",
"main": "src/main.server.ts",
"tsConfig": "src/tsconfig.server.json",
"externalDependencies": [
"#firebase/firestore"
]
}
},
"deploy": {
"builder": "#angular/fire:deploy",
"options": {
"ssr": true
}
}
}
},
"gadaproductions-e2e": {
"root": "e2e/",
"projectType": "application",
"prefix": "",
"architect": {
"e2e": {
"builder": "#angular-devkit/build-angular:protractor",
"options": {
"protractorConfig": "e2e/protractor.conf.js",
"devServerTarget": "gadaproductions:serve"
},
"configurations": {
"production": {
"devServerTarget": "gadaproductions:serve:production"
}
}
},
"lint": {
"builder": "#angular-devkit/build-angular:tslint",
"options": {
"tsConfig": "e2e/tsconfig.e2e.json",
"exclude": [
"**/node_modules/**"
]
}
}
}
}
},
"defaultProject": "gadaproductions",
"cli": {
"analytics": false
}
}
Thanks for your help.
Update firebase SDK snippet in environment.prod.ts file.
Hope this will help to your issue.
I'm working with react ant-design and I'm using #media queries for styling but it keeps throwing the error given below
#btn {
^
Media definitions require block statements after any features
in /home/osh/WebstormProjects/ant-design-kickstart/src/styles/styles.less (line 69, column 8)
# ./src/styles/styles.less 2:14-142 21:1-42:3 22:19-147
# ./src/index.js
# multi (webpack)-dev-server/client?http://localhost:8081 (webpack)/hot/dev-server.js react-hot-loader/patch ./src/index.js
Failed to compile.
I have given the related files below
------------styles.less file---------------
#media only screen and (max-width: 768px) {
#btn {
width: 50%;
margin-top: 200px;
align-self: center;
}
Button {
width: 1000%;
marginBottom: '25px'
}
Input {
align-self: center;
width: 250px;
}
h4 {
color: #5400ff;
}
.appDashCard {
background: #fff;
padding: 10%;
/*//minHeight: 280px;*/
align-content: center;
}
}
#media only screen and (min-width: 768px) {
#btn {
width: inherit;
margin-right: 30px;
margin-left: 400px;
margin-top: 30px;
}
h4 {
color: #ff2600;
}
.appDashCard {
background: #fff;
padding: 24px;
minHeight: 280px;
}
.selectBox {
width: 100%;
}
}
----------package.json----------
{
"name": "ant-design-kickstart",
"version": "1.0.0",
"description": "An opinionated starter-kit for Ant Design",
"scripts": {
"start": "webpack-dev-server --config ./webpack.dev.js --mode development",
"build": "webpack --config ./webpack.prod.js --mode production",
"precommit": "pretty-quick --staged"
},
"author": "Madusha Prasanjith",
"license": "MIT",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-plugin-import": "^1.6.7",
"babel-preset-env": "^1.6.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-2": "^6.24.1",
"css-loader": "^0.28.11",
"file-loader": "^1.1.11",
"husky": "^0.14.3",
"less": "^3.0.1",
"less-loader": "^4.1.0",
"less-vars-to-js": "^1.2.1",
"prettier": "1.11.1",
"pretty-quick": "^1.4.1",
"react-hot-loader": "^4.0.0",
"style-loader": "^0.20.3",
"url-loader": "^1.0.1",
"webpack": "^4.3.0",
"webpack-cli": "^2.0.13",
"webpack-dev-server": "^3.1.5"
},
"dependencies": {
"antd": "^3.3.3",
"axios": "^0.18.0",
"media-queries": "^1.0.5",
"moment": "^2.21.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react-router-dom": "^4.2.2",
"style-loader": "^0.20.3"
}
}
-----------webpack.dev.js----------
const webpack = require("webpack");
const path = require("path");
const fs = require("fs");
const lessToJs = require("less-vars-to-js");
const themeVariables = lessToJs(
// fs.readFileSync(path.join(__dirname, "./src/styles/ant-default-vars.less"), "utf8")
fs.readFileSync(path.join(__dirname, "./src/styles/styles.less"), "utf8")
);
module.exports = {
entry: ["react-hot-loader/patch", "./src/index.js"],
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ["babel-loader"]
},
{
test: /\.less$/,
use: [
{
loader: "style-loader"
},
{
loader: "css-loader",
options: {
sourceMap: true
}
},
{
loader: "less-loader",
options: {
sourceMap: true,
modifyVars: themeVariables,
javascriptEnabled: true
}
}
]
},
{
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
loader: "url-loader",
options: {
limit: 10000
}
}
]
},
resolve: {
extensions: ["*", ".js", ".jsx"]
},
output: {
path: __dirname + "/dist",
publicPath: "/",
filename: "bundle.js"
},
plugins: [new webpack.HotModuleReplacementPlugin()],
devServer: {
contentBase: "./dist",
hot: true
}
};
This often indicates a syntax error. Please take a look at 'Button'. It has a property called 'marginBottom', rename it to margin-bottom, please also add a semicolon after the statement (although that shouldn't make a difference). Also, you should rename 'Button' to 'button' and 'Input' to 'input'.
Can anyone explain this to me. I'm trying to inject a CSS file onto a webpage using the content_script with Google extensions, but my css file never gets added to the webpage. Can someone tell me what I'm doing wrong and help me fix it? thanks
Manifest:
{
"name": "Extension",
"version": "0",
"description": "",
"permissions": ["tabs", "http://*/*", "https://*/*", "file:///*/*"],
"content_scripts": [
{
"matches": [ "http://*/*", "https://*/*", "file:///*/*"],
"css": ["myStyles.css"],
"js": ["myScript.js"],
"all_frames": true
}
]
}
myStyles.css
#test {
margin: 0 10px;
background: #fff;
padding: 3px;
color: #000;
}
The style sheet is actually injected, but not applied, because other styles override the rules. To get the rules to work, you have some options:
Increase the specificity of your CSS rules.
Suffix every rule with !important:
#test {
margin: 0 10px !important;
background: #fff !important;
padding: 3px !important;
color: #000 !important;
}
Inject the CSS via a content script:
myScript.js:
var style = document.createElement('link');
style.rel = 'stylesheet';
style.type = 'text/css';
style.href = chrome.extension.getURL('myStyles.css');
(document.head||document.documentElement).appendChild(style);
manifest.json
{
"name": "Extension",
"version": "0",
"description": "",
"manifest_version": 2,
"permissions": ["tabs", "http://*/*", "https://*/*", "file:///*/*"],
"content_scripts": [
{
"matches": [ "http://*/*", "https://*/*", "file:///*/*"],
"js": ["myScript.js"],
"all_frames": true
}
],
"web_accessible_resources": ["myStyles.css"]
}
The last key, web_accessible_resources is necessary when manifest version 2 is active, so that the CSS file can be read from a non-extension page.
If you want to target a specific website do:
"matches": ["https://*.google.com/*"]
That //* before .google is the real trick for me as using www doesn't works.