add custom snippets to emmet - emmet

I'm using emmet with Brackets.
In this file lib/AppSupport/Brackets/extensions/user/brackets-emmet/snippets.json
I add this line at the right place :
"clearfix":".clearfix:before, .clearfix:after { content: \" \"; display: table; } .clearfix:after { clear: both; } /* For IE 6/7 only */ .clearfix { *zoom: 1; }",
This works but this not looks like a good practice so I try to create an other file mysnippets.json in the same folder with this tiny sample :
{
"css": {
"snippets": {
"test": "ok"
}
}
}
But it doesn't work (after save/relaunch).
Is it possible to add an external json in the same folder ? What's worng ?

Here is the solution for Brackets (testing on 43) :
http://circlewaves.com/blog/how-to-add-custom-snippets-to-emmet-for-brackets/
All you need — is to create a JSON-file called with name started with “snippets”, for example: snippets-mysnippets.json, snippets_team.json, snippets-php.json and etc; and set extension folder with this JSON file in Emmet options:
On my mac I add something like : /Users/benoit/Documents/Brackets/
adding snippets-css.json with this :
{
"css": {
"snippets": {
"reset":"/* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 License: none (public domain) */\n html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } \n/* HTML5 display-role reset for older browsers */\n article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } body { line-height: 1; } ol, ul { list-style: none; } blockquote, q { quotes: none; } blockquote:before, blockquote:after, q:before, q:after { content: ''; content: none; } table { border-collapse: collapse; border-spacing: 0; }",
"clearfix":".clearfix:before, .clearfix:after { content: \" \"; display: table; } .clearfix:after { clear: both; } /* For IE 6/7 only */ .clearfix { *zoom: 1; }" }
}
}

open brackets-emmet/main.js
define a variable at the near top like this:
var userSnippets = require('text!emmet/userSnippets.json');
and then find this line:
emmet.loadSystemSnippets(snippets);
copy it and replaces by this:
emmet.loadSystemSnippets(userSnippets);
and now, create a file named userSnippets.json in: brackets-emmet/node_modules/emmet/lib/
edit your custom snippets in here, finally is press F5 ( command + r ) to refresh Brackets.
Done! :)

The documentation at http://docs.emmet.io/customization/snippets/ directs you to create an extensions folder and place within it a snippets.json or snippets-*.json (where * can be any name). In the new json file, you create your new snippets or override the standard snippets in the standard snippets.json file. In the Emmet preferences, put the path to the extensions folder. In Win 7, it appears that you need forward slashes in the path name. Your custom snippets.json file will not be overridden with updates. Following this procedure works with Brackets sprint 41 on Win 7.

On my Windows I added to Brackets - emmet - preferences path:
C:/Users/Andrew/AppData/Roaming/Brackets/extensions/user
And created my own snippets.json in this folder and it works!

It looks like the Emmet extension for Brackets only loads snippets from that one location. So if you want to customize your snippets, it seems the only option is to edit that file (and re-apply your edits any time you update the extension version). The snippets.json format is officially documented here: http://docs.emmet.io/customization/snippets/
It would be nice if Emmet supported a separate user-editable config file, though. Might be worth filing an issue on the Emmet extension to request this...

"!!": "{<!DOCTYPE html>}>html[lang='dk']>(head>meta[charset='${charset}']+meta[http-equiv='X-UA-Compatible'][content='IE=edge']+meta[name='viewport'][content='width=device-width,initial-scale=1.0']+link[href=/css/bootstrap.min.css]+link:css+title>{titel})+(body>div.container>div.row>div.col-12)",
This worked for me and might work for you use it at your own risk!
Adding custom docksnippet to Emmet:
1). Go to Help --> Show Extension Folder.
2). Browse to: C:\Users\daniel\AppData\Roaming\Brackets\extensions\user\brackets-emmet\node_modules\emmet\lib\snippets.json and manke a backup of the file before you edit it!
3). Search snippts.json for "html" with Ctrl + F and look for "abbreviations".
4). Add custom template with hook:
"!!": "{}>html[lang='dk']>(head>meta[charset='${charset}']+meta[http-equiv='X-UA-Compatible'][content='IE=edge']+meta[name='viewport'][content='width=device-width,initial-scale=1.0']+link[href=/css/bootstrap.min.css]+link:css+title>{titel})+(body>div.container>div.row>div.col-12)",
5). Save the original snippts.json file and reload with extensions (F5).

Related

Emmet missing semicolon inside css media query in Sublime Text 4

Emmet autocomplete doesn't add semicolon after css rules inside media query.
div {
display: none;
}
#media (max-width: 991.98px) {
div {
display: none
}
}
Outside media query
Inside media query
This is a bug in the plug-in which is under investigation. Keep track of it here: https://github.com/emmetio/sublime-text-plugin/issues/173
UPDATE: This has now been fixed.

Ability to disable text input in package "vue-search-select" - "basic-select" component

I want to disable text input in the "basic-select" component, from the "vue-search-select" package
because there are already ready-made styles for it, and I would not want to create a separate customized select
is it possible? Tell me please
I guess there is no explicit API to disable text input because this package is going to make a "searchable" select component. The text input can be hidden using CSS, however.
.search {
display: none;
}
/* or even better */
.ui.search.dropdown > input.search {
display: none;
}
However, you should be careful about the selector you choose. Depending on your project, it might have some side effects. It might be better to add a custom class to the component and use it as follows:
.my-custom-class .ui.search.dropdown > input.search {
display: none;
}

Secondary Navigation Links (Absolute and Relative positioning) (CSS)

All my secondary header navigation links can only go (top left, bottom left, top right, etc.).
Currently enabled as "top left", however I want two out of those four links to be "top right".
Current code works perfect, other than after the 75% resizing mark, the links discombobulate.
#media screen and (min-width: 800px)
{
a[href="/terms-of-use"]
{
position:absolute;
right:120px;
}
a[href="/privacy"]
{
position:absolute;
right:200px;
}
}
It has been said that using absolute positioning within flex-box will not work reliably. I'm going to guess that, because I was viewing your site in Firefox and Chrome and did not see the issue, that you are viewing your site in Safari, where the issue can be seen.
In any case, due to the above, I would recommend using Javascript in order to move the navigation items to the desired location. Then, add some additional CSS in order to get those newly-moved items to look like the others.
First, remove the CSS you've added that addresses those navigation items.
Then add this via site-wide Footer code injection:
<script>
(function() {
var targetLinks = document.querySelectorAll(".Header a[href='/terms-of-use'], .Header a[href='/privacy']");
var targetParent = document.querySelector(".Header-inner [data-nc-container='top-right']");
var i;
for (i=0; i<targetLinks.length; i++) {
targetParent.appendChild(targetLinks[i]);
}
})();
</script>
And finally, add this via the CSS Editor:
body:not(.tweak-header-secondary-nav-hover-style-button):not(.tweak-header-secondary-nav-inherit-styles) [data-nc-container='top-right'] .Header-nav-item {
margin: 0 .618em;
padding: .618em 0;
font-family: myriad-pro;
-webkit-flex-shrink: 0;
flex-shrink: 0;
}
[data-nc-base="header"] [data-nc-container="top-right"] [data-nc-element="cart"] {
padding-left: 33px;
}
[data-nc-container='top-left'] [href='/privacy'] {
display: none;
}
[data-nc-container='top-left'] [href='/terms-of-use'] {
display: none;
}

Titles truncated automatically

I am having a strange issue. The titles that I specify in toolbar or in Ext.Msg.alert is automatically truncated and a '...' is appended.
How to get rid of this? I want full titles in Toolbar, message boxes and everywhere else.
It's a bug in Webkit which are reported in sencha's forum that you can refer it here or here:
Use this in your css or .sass file as a solution:
.x-title{padding:0 .3em;}
.x-title .x-innerhtml{padding: 0;}
Or:
.x-title .x-innerhtml:after {
display: inline-block;
content: '';
width: 0.3em;
}
The problem is because of ellipsis property assigned to .x-title by default. You need to change that to to clip property.
Give a cls property to your config.
For example :
cls : 'textFormat',
Then in a css file :
.textFormat .x-title .x-innerhtml{
text-overflow : clip !important;
}
This code will override the existing code for the particular toolbar.

remove 'Processing' instead of hide

When we start sorting or other things datatables has option to show 'Process' message. All is fine , only when it hides 'Processing' there is still stay space where 'Processing' is placed. So html table jumping down when Processing showing then when data have been loaded Processing hidding but html table isn't jumping back up so there is stay visible place for it.
Question, how to make datatable to remove Processing tag instead of just hide. Thanks
EDIT. I add html code
<div id="search_table_processing" class="dataTables_processing" style="visibility: hidden;">Processing...<img alt="< <" src="/themes/third_party/linkedin_search/img/165.gif"></div>
Well drat, I just ran into this and had to dig into it myself.
In version 1.9.0 you can search for this snippet:
an[i].style.visibility = bShow ? "visible" : "hidden";
(Found after searching for visibility.)
In the minified version it's currently this (using the NuGet package):
c[d].style.visibility=b?"visible":"hidden";
The problem is we neglected to style .dataTables_processing, as per the sample CSS files. Here's what one of the samples has for styling:
.dataTables_processing {
position: absolute;
top: 0px;
left: 50%;
width: 250px;
margin-left: -125px;
border: 1px solid #ddd;
text-align: center;
color: #999;
font-size: 11px;
padding: 2px 0;
}
Once it's styled (or bProcessing is set to false), there shouldn't be an issue.
If you're comfortable changing the functionality of the plug-in (if you think you can remember to change it back), then you could switch it to use display instead of visibility.
In case you are using Internationalisation - "oLanguage" attribute in your datatables constructor
replace the old sProcessing value with this in your localization file in order to place a custom image while processing :
"sProcessing": "<img src='/themes/third_party/linkedin_search/img/165.gif'/>",
and here is how you link your datatables to a localization file (which can be downloaded from the datatables website Internationalisation of datatables)
.
.
.
"oLanguage": {
"sUrl": "../../jQuery/dataTables/media/MyLanguageFilesFolder/en_US.txt"
}
.
.
.
If you not using the Internationalisation of datatables you can always set the "sProcessing" value with the suggested above...
here an example :
$(document).ready(function() {
$('#example').dataTable( {
"oLanguage": {
"sProcessing": "<img src='/themes/third_party/linkedin_search/img/165.gif'>"
}
} );
} );
Changing
an[i].style.visibility = bShow ? "visible" : "hidden";
to
an[i].style.display = bShow ? "block" : "none";
didn't work for me. However, I accomplished it by changing the statement to
if (bShow == false) {
an[i].style.display = "none";
}
else {
an[i].style.display = "block";
}
Hope this helps anyone who doesn't want to add any css code and just go right to the source!
For the Datatables version 1.9.4, just edit the file jquery.dataTables.js line 3005, and change the following:
an[i].style.visibility = bShow ? "visible" : "hidden";"block" : "none";
to
an[i].style.display = bShow ?
Worked for me!
If you want the text to go away while the backdrop should be there, why not just add:
div.dataTables_processing{ color: transparent; }