25
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【Grunt】ファイルの指定方法いろいろ

Last updated at Posted at 2014-07-16

Gruntの色々なファイルの指定方法をメモ。

##一つのファイルを指定

gruntfile.js
{src: 'foo/this.js', dest: ...}

##配列で複数指定

gruntfile.js
{src: ['foo/this.js', 'foo/that.js', 'foo/the-other.js'], dest: ...}

##パターンに当てはまるファイルすべて

gruntfile.js
{src: 'foo/th*.js', dest: ...}

##先頭にaかbが含まれるファイルすべて

gruntfile.js
{src: 'foo/{a,b}*.js', dest: ...}

##先頭にaかbが含まれるファイルすべて:その2

gruntfile.js
{src: ['foo/a*.js', 'foo/b*.js'], dest: ...}

##すべてのフィイル

gruntfile.js
{src: ['foo/*.js'], dest: ...}

##最初にファイルを指定した後にすべてのファイル

gruntfile.js
{src: ['foo/bar.js', 'foo/*.js'], dest: ...}

##bar.jsを除くすべてのファイル

gruntfile.js
{src: ['foo/*.js', '!foo/bar.js'], dest: ...}

##すべてのファイル、最後にbar.js

gruntfile.js
{src: ['foo/*.js', '!foo/bar.js', 'foo/bar.js'], dest: ...}

##ファイルパスを使用

gruntfile.js
{src: ['src/<%= basename %>.js'], dest: 'build/<%= basename %>.min.js'}

##gruntファイルのタスクに設定されたパスも参照できる

gruntfile.js
jshint:{
	all:{
		src:'foo/js/'
	}
}

{src: ['foo/*.js', '<%= jshint.all.src %>'], dest: ...}

###参考

25
25
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
25

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?