Skip to content

Commit af652bb

Browse files
committed
Add custom blocks questions and answers
1 parent d963c04 commit af652bb

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

README.md

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,9 @@ List of 300 VueJS Interview Questions
135135
|126| [How do you apply linting for css?](#how-do-you-apply-linting-for-css)|
136136
|127| [How do you use eslint plugin?](#how-do-you-use-eslint-plugin)|
137137
|128| [What is the purpose of eslint loader?](#what-is-the-purpose-of-eslint-loader)|
138+
|129| [What is CSS extraction?](#what-is-css-extraction)|
139+
|130| [What are custom blocks?](#what-are-custom-blocks)|
140+
|131| [What are the features of stylelint?](#what-are-the-features-of-stylelint?)|
138141

139142
1. ### What is VueJS?
140143
**Vue.js** is an open-source, progressive Javascript framework for building user interfaces that aim to be incrementally adoptable. The core library of VueJS is focused on the `view layer` only, and is easy to pick up and integrate with other libraries or existing projects.
@@ -2371,4 +2374,59 @@ List of 300 VueJS Interview Questions
23712374
]
23722375
}
23732376
}
2374-
```
2377+
```
2378+
129. ### What is CSS extraction?
2379+
CSS Extraction is used to extract all the processed CSS in all Vue components into a single CSS file. For webpack4, you need to install below npm command,
2380+
```javascript
2381+
npm install -D mini-css-extract-plugin
2382+
```
2383+
You can configure this plugin in webpack as below,
2384+
```javascript
2385+
// webpack.config.js
2386+
var MiniCssExtractPlugin = require('mini-css-extract-plugin')
2387+
2388+
module.exports = {
2389+
// other options...
2390+
module: {
2391+
rules: [
2392+
// ... other rules omitted
2393+
{
2394+
test: /\.css$/,
2395+
use: [
2396+
process.env.NODE_ENV !== 'production'
2397+
? 'vue-style-loader'
2398+
: MiniCssExtractPlugin.loader,
2399+
'css-loader'
2400+
]
2401+
}
2402+
]
2403+
},
2404+
plugins: [
2405+
// ... Vue Loader plugin omitted
2406+
new MiniCssExtractPlugin({
2407+
filename: 'style.css'
2408+
})
2409+
]
2410+
}
2411+
```
2412+
130. ### What are custom blocks?
2413+
You can define custom language blocks inside *.vue files based on the `lang` attribute of the block, the block's tag name, and the rules in your webpack config. You can also use `resourceQuery` to match a rule against a custom block with no lang. For example, to match against <message> custom blocks.
2414+
```javascript
2415+
{
2416+
module: {
2417+
rules: [
2418+
{
2419+
resourceQuery: /blockType=message/,
2420+
loader: 'loader-to-use'
2421+
}
2422+
]
2423+
}
2424+
}
2425+
```
2426+
131. ### What are the features of stylelint?
2427+
Below are the list of major stylelint features
2428+
1. It has more than **160 built-in rules** to catch errors, apply limits and enforce stylistic conventions
2429+
2. Understands **latest CSS syntax** including custom properties and level 4 selectors
2430+
3. It **extracts embedded styles** from HTML, markdown and CSS-in-JS object & template literals
2431+
4. Parses **CSS-like syntaxes** like SCSS, Sass, Less and SugarSS
2432+
5. Supports **Plugins** for reusing community plugins and creating own plugins

0 commit comments

Comments
 (0)