Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
grunt-textfile
Advanced tools
A grunt task to quickly create text files for text file based blogging.
A grunt task to quickly create text files for text file based blogging.
This plugin requires Grunt ~0.4.1
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-textfile --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-textfile');
In your project's Gruntfile, add a section named textfile
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
textfile: {
options: {
dest: 'content/blog',
openFile: true
},
linkpost: {
options: {
template: 'kirby-linkpost.tpl',
urlFormat: 'PREFIX-SLUG/article.link.txt',
customVars: {
foo: 'bar',
bar: 'baz'
}
}
},
article: {
options: {
template: 'kirby-article.tpl',
urlFormat: 'PREFIX-SLUG/article.txt'
}
}
}
})
Store your templates in the templates folder and use the grunt.template
and the grunt.option
API for placeholders.
Example template:
Title: <%= grunt.option('title') %>
----
Link: <%= grunt.option('link') %>
----
Date: <%= grunt.template.today('yyyy-mm-dd') %>
----
Author: Jean-Luc Picard
----
Foo: <%= foo %>
----
Text:
Type: String
Default value: 'example.tpl'
Type: String
Default value: 'templates'
Destination for the generated file. Needs to be set to the folder in which your text files are stored.
Type: String
Default value: 'tmp'
In case you need to use the date the name of the generated file, you can change the format with this option.
Type: String
Default value: 'yyyy-mm-dd'
Type: String
Default Value: 'PREFIX-SLUG/article.link.txt'
This option lets you set the desired formatting of the filename. There are 3 keywords you can use in here:
// PREFIX is needed for Kirby blogs. It prepends an ascending number to the folder name
// of the folder containing your textfile
'PREFIX'
// This keyword is replaced by the slug generated with the title
'SLUG'
// This keyword is replaced by the date of today
// formatted via options.urlDateFormat
'DATE'
Specify if you want the generated file to opened in an editor.
Type: Boolean
Default Value: false
Specify which editor you want the generated file to be opened with.
Type: String
Default Value: subl
Set some custom variables to use within your template.
Type: Object
No default value
grunt.initConfig({
textfile: {
options: {
dest: 'content/blog',
openFile: true
},
linkpost: {
options: {
template: 'kirby-linkpost.tpl',
urlFormat: 'PREFIX-SLUG/article.link.txt',
customVars: {
foo: 'bar'
}
}
}
},
})
Title: <%= grunt.option('title') %>
----
Link: <%= grunt.option('link') %>
----
Date: <%= grunt.template.today('yyyy-mm-dd') %>
----
Author: kahlil-lechelt
----
Foo: <%= foo %>
----
Text:
grunt textfile --link="http://thisisalink.net" --title="This is a title"
grunt.initConfig({
textfile: {
options: {
dest: '_posts',
openFile: true
},
article: {
options: {
template: 'jekyll-article.tpl',
urlFormat: 'DATE-SLUG.md'
}
}
},
})
---
Title: <%= grunt.option('title') %>
Date: <%= grunt.template.today('yyyy-mm-dd') %>
Author: kahlil-lechelt
---
grunt textfile --title="This is a title"
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
To run the tests clone this repo, do npm install
and then grunt
.
Only releases with bigger changes will be listed here. Not listed are minor releases only containing small fixes and clean up.
v0.1.7: add 'openFile' and 'openFile' options to open the generated file in an editor.
v0.1.0: initial release.
FAQs
A grunt task to quickly create text files for text file based blogging.
The npm package grunt-textfile receives a total of 2 weekly downloads. As such, grunt-textfile popularity was classified as not popular.
We found that grunt-textfile demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.